Home > OS >  How to Check if there are rows/samples that has all features nan value?
How to Check if there are rows/samples that has all features nan value?

Time:10-15

i have checked my data and found that all features have the same number of nan values which is 114 nan values for every features.

I have a hunch that there are 114 samples that have all the features marks as nan. my question is how to check the index samples that has all nan values in each feature?

because my data is so big, and I just want to delete that samples.

CodePudding user response:

I think DataFrame.dropna() should work for you. Here's a link to the Pandas Docs: pandas.DataFrame.dropna

# If your DataFrame is df
df = df.dropna(axis=0, how='all')
  • axis=0 means it will drop rows with null values
  • how='all' means it will only drop the row if ALL values are null
  • Related