How can I show a dataframe wich has sorted category value using pandas pd.Ctegorical

Hi all,
I have a categorical column on pandas dataframe

arr_sort_salary = np.array([‘A’,‘B’,‘C’,‘D’,‘E’])
df[‘Local Salary grade’] = pd.Categorical(df[‘Local Salary grade’],
categories=arr_sort_salary,
ordered=True)

but when I try to show a dataframe via a group by, I get this
NotImplementedError: Dtype category not understood.

    #salary        c = df_temp.groupby(['Local Salary grade','Sexo'])['id'].count().rename('cantidad')
    c = pd.concat([c,c.groupby(level=0).transform(lambda x: (x / x.sum()).round(2)).rename('porc').apply(lambda x: round(x*100,2))
              ],axis=1)
    c  = c.reset_index()