WeightedRandomSampler Error

I am doing the weightedrandomsampler on my dataset. I am using it to create the training data, can someone tell me what I am doing wrong
Code and Error

I don’t think the WeightedRandomSampler creates the error, but your pandas.DataFrame raises a KeyError so you should check how this DataFrame is called and make sure the keys are valid.

PS: it’s better to post code snippets by wrapping them into three backticks ```, which would make debugging easier. :wink:

1 Like