0

I'm trying to drop rows of a dataframe if the size of the array in a column is not the right one.

This is what I have:

df= df.drop(df[(df['col'].df.len() != 100)].index)

But it outputs the actual rows where the conditions is met and then it says KeyError:0

type(df['col']) is <class 'pandas.core.series.Series'>

df['col'][0] = [0.0059561  0.         0.0043337  ... 0.00520846 0.         0.01370436] 
rebrid
  • 430
  • 8
  • 27
  • 1
    Would you mind sharing a sample dataframe? The expression seems correct. Although `set` is a poor choice as variable name... – Tranbi Sep 01 '22 at 11:09
  • 1
    Your question needs a minimal reproducible example consisting of sample input, expected output, actual output, and only the relevant code necessary to reproduce the problem. See [How to make good reproducible pandas examples](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) for best practices related to Pandas questions. – itprorh66 Sep 01 '22 at 13:26

0 Answers0