标签: python python-3.x pandas dataframe
要计算数据框各列中缺失值的总数,我们使用
df.isnull().sum(axis=0)
并计算数据框每一行中缺失值的总数,我们使用
df.isnull().sum(axis=1)
这是违反直觉的,因为轴= 0表示行,轴= 1表示列。还考虑到我们使用下面的axis = 1删除列
df = df.drop([]'BuildingArea','YearBuilt','CouncilArea'], axis=1)
由于我对这种理解心存感激,任何帮助将不胜感激。