tup_list = [1,2,3,4,5]
weight_list = [0.5,0.6,0.1,0.7]
draw = choice(tup_list, sample_size_d, replace=False, weight_list)
when I try to run it, I get error: SyntaxError: non-keyword arg after keyword arg How could I fix it?
tup_list = [1,2,3,4,5]
weight_list = [0.5,0.6,0.1,0.7]
draw = choice(tup_list, sample_size_d, replace=False, weight_list)
when I try to run it, I get error: SyntaxError: non-keyword arg after keyword arg How could I fix it?
Here weight_list
is a non-keyword arg. When calling a function in Python, all keyword arguments (key=value type) should follow all non-keyword arguments. Your call to choice
should be like:
draw = choice(tup_list, sample_size_d, weight_list, replace=False)
See this question: Python normal arguments vs. keyword arguments