pandas groupby will by default sort. But I\'d like to change the sort order. How can I do this?
I\'m guessing that I can\'t apply a sort method to the returned gro
Do your groupby, and use reset_index() to make it back into a DataFrame. Then sort.
grouped = df.groupby('mygroups').sum().reset_index() grouped.sort_values('mygroups', ascending=False)