Hi, I’m trying to do an iteration, where I use a dictionary that gives me an array with values (“players”) and an array with weights (“weights”) with the same size, to make a sample. When I do it outside of iteration it has no problem, but on the first iteration it throws me this error: MethodError: no method matchinggetindex (:: Nothing, :: String)
Here is the code that works outside the iteration, but inside throws the error above.
new_player = sample(my_dict["2499719"][1631]["Z4.2"][14763]["players"],
Weights(my_dict["2499719"][1631]["Z4.2"][14763]["weights"]))
The complete info of the error is:
MethodError(getindex, (nothing, "2499719"), 0x0000000000006d1a)
MethodError: no method matching getindex(::Nothing, ::String)
Stacktrace:
[1] my_function(::String, ::Int64, ::Int64) at .\In[44]:91
[2] top-level scope at In[45]:1
[3] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1091
I hope you can help me!