简体   繁体   English

如何检查是否存在具有所有特征 nan 值的行/样本?

[英]How to Check if there are rows/samples that has all features nan value?

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.我检查了我的数据,发现所有特征都具有相同数量的 nan 值,每个特征都有 114 个 nan 值。

I have a hunch that there are 114 samples that have all the features marks as nan.我有一种预感,有 114 个样本的所有特征都标记为 nan。 my question is how to check the index samples that has all nan values in each feature?我的问题是如何检查每个特征中具有所有 nan 值的索引样本?

because my data is so big, and I just want to delete that samples.因为我的数据太大了,我只想删除那些样本。

I think DataFrame.dropna() should work for you.我认为 DataFrame.dropna() 应该适合你。 Here's a link to the Pandas Docs: pandas.DataFrame.dropna这是 Pandas 文档的链接: 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 axis=0 意味着它将删除具有空值的行
  • how='all' means it will only drop the row if ALL values are null how='all' 意味着它只会在所有值都为空时删除该行

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM