I have performed a group by function, and I would like to sort it by month in chronological order, how can I do so? Currently the function is sorting month on alphabetical order:
func = {'Predictions':['count','mean','median']}
table1 = df.groupby(['FLAG','MONTH']).agg(func)
table1
Predictions
count mean median
FLAG MONTH
0 Apr 49812 106.458209 75.325309
Aug 44514 93.718901 74.485782
Feb 51583 98.921119 74.199794
Jan 54837 100.381814 74.682187
Jul 49873 100.621877 73.233328
Jun 47950 103.688532 74.150171
Mar 52816 106.094774 75.104832
May 49404 106.847784 75.844241
Oct 41828 94.744952 76.178077
Sep 41074 96.430351 75.335261
1 Apr 83377 285.631679 144.582569
Aug 66285 217.619038 127.087037
Feb 79693 310.919925 180.507922
Jan 64730 290.113451 137.291571
Jul 105213 298.337893 146.956319
Jun 90305 312.484185 136.222903
Mar 97274 308.013477 165.752471
May 87927 310.162600 142.350688
Oct 47064 258.213619 85.445310
Sep 47337 240.361602 84.597842
Thanks for your help!