I'm successfully extracting and counting data from my dataframe but I'd like to sort on the resulting count values.
groupby snippet:
my_df.groupby('name').Id.nunique().head(5)
Results:
Name
nameA 4
nameB 1
nameC 1
nameD 6
nameE 2
But I'd like to order the results as follows;
Name
nameD 6
nameA 4
nameE 2
nameB 1
nameC 1
I'm assuming this should be straight forward and I'm hoping someone can point me in the right direction.
DataFrame.sort_values