I have a dataframe with the column names:
'01 2017' '02 2017' ...... '12 2017' '01 2018' '01 2018' ....
so you can see there is a repeat of 01 2018 and 01 2018 for two columns. I would like to sum the columns without rearranging the columns.
I have this code currently:
df.groupby(lambda x:x, axis=1).sum()
However, the ouput is:
'01 2017' '01 2018' ... '12 2017' '12 2018'
This sorts it by the first 2 digits and messes up the arrangement.