In code snippet Pandas DataFrame Group by one Column and Aggregate using MAX, MIN, MEAN and MEDIAN, it shows how to do aggregations in a pandas DataFrame. This code snippet shows you how to flatten the DataFrame (multiindex) after aggregations.
Sample output:
category value_max value_min value_mean value_median
0 A 90 0 45 45
1 B 91 1 46 46
2 C 92 2 47 47
3 D 93 3 48 48
4 E 94 4 49 49
5 F 95 5 50 50
6 G 96 6 51 51
7 H 97 7 52 52
8 I 98 8 53 53
9 J 99 9 54 54