首页 > 解决方案 > 根据缺失值的“Amount.Requested”列删除数据框中的整行

问题描述

考虑我是否有一列Amount.Requested并且它有一些缺失值,所以现在基于这些缺失值Amount.Requested我想删除整行,因为如果该列Amount.Requested有缺失值,那么为我保留该客户端的数据是没有意义的示例代码。

标签: pythonpython-3.xpandasmachine-learning

解决方案


如果您有空值,那么要单独删除带有空值的行,请尝试

df = df.loc[~df['Amount.Requested'].isna()] 

or

df = df.loc[df['Amount.Requested'] > 0] 

推荐阅读