I am a python and pandas beginner and I\'m having trouble sorting a data frame after a groupby operation. I can get sorted data after groupby and count but when I put all the da
One simple way is to just convert the index to date, sort and then convert back to month-year.
result.index = pd.to_datetime(result.index)
result.sort_index(inplace=True)
result.index = monthly_transpose.index.strftime('%B-%Y')
When converting to date, pandas converts the month-year to the first date of each month nad hence the sorting is made possible. Hope it helps.