📜  计数缺失值 groupby - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:03.941000             🧑  作者: Mango

代码示例1
CLASS FEATURE1 FEATURE2 FEATURE3
  X      A       NaN      NaN
  X     NaN       A       NaN
  B      A        A        A
  
 df.drop('CLASS', 1).isna().groupby(df.CLASS, sort=False).sum().reset_index()

  CLASS  FEATURE1  FEATURE2  FEATURE3
0     X       1.0       1.0       2.0
1     B       0.0       0.0       0.0