I have a dataframe like
0 1 One Two Tech Tool First Second Third First Second Third Auto UIP 23 18 5 59 56 3 AI ALT 45 34 11 32 12 20
Need an output like
0 1 One Two Sum Tech Tool First Second Third First Second Third First Second Third Auto UIP 23 18 5 59 56 3 82 74 8 AI ALT 45 34 11 32 12 20 77 46 31
Here for Sum First 82=23+59, Second 74=18+56, Third 8=5+3 Similarly for others. I am beginner in multiindex dataframe please help
You can try:
df.groupby(level=1, axis=1).sum()
1.4m articles
1.4m replys
5 comments
57.0k users