count missing values groupby

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

Here is what the above code is Doing:
1. Drop the CLASS column from the dataframe
2. Check for NaN values in the dataframe
3. Group by the CLASS column
4. Sum the NaN values for each column
5. Reset the index
6. Add the CLASS column back to the dataframe