简体   繁体   English

在 Pandas Python 中检查所有列后删除没有值的行

[英]Drop rows with no values after checking all columns in Pandas Python

I have a dataframe like below.我有一个如下所示的数据框。 I would like to check all columns and delete rows if no values.如果没有值,我想检查所有列并删除行。

在此处输入图片说明

你可以用dropna检查

df = df.dropna(how = 'all')

Use the dropna() function for your dataframe.为您的数据dropna()使用dropna()函数。

df.dropna(axis=0, how="all")

axis=0 performs deletion on rows how="all" deletes the rows if all the columns for that row are empty. axis=0对行执行删除how="all"如果该行的所有列都为空,则删除行。 Use " any" if you want the row to be deleted in case of any missing column.如果您希望在缺少任何列的情况下删除该行,请使用" any" You can also use the thresh=<int> parameter to delete the row if the number of missing values exceeds the threshold.如果缺失值的数量超过阈值,您还可以使用thresh=<int>参数删除该行。

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

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