[英]Drop rows with no values after checking all columns in Pandas Python
你可以用dropna
检查
df = df.dropna(how = 'all')
df.dropna()
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.