data:
Requirement: We want to count the number of missing values of different groups (A, B) in column a.
Implementation: First extract the missing values of different columns, and then use groupby for statistical calculation
pd.DataFrame(df[x].isnull().groupby(df['a']).sum() for x in df.columns[1:]).T.reset_index()
Reference source: Pandas count null values in a groupby function