文章目录
- 缺失值所在的列
- 返回某列缺失值所在的行
- 缺失值字典,{列:缺失行}
参考:https://blog.csdn.net/m0_54650283/article/details/122382632
缺失值所在的列
df.isna().any()
返回某列缺失值所在的行
df.loc[df['A'].isnull()].index.tolist()
缺失值字典,{列:缺失行}
a = df.isnull().any()
a = a.loc[a==True]
columns = a.index.tolist()
mydict = {}#创建一个字典来存储所有的位置
temp = []
for column in columns:
temp = df.loc[df[column].isnull()].index.tolist()
mydict[column] = temp
mydict
最后
以上就是大力火最近收集整理的关于Pandas探索缺失值的全部内容,更多相关Pandas探索缺失值内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复