I have a pandas dataframe with multi-index column headers that looks like this:
I would like it to look like this:
>Solution :
Try stack and swaplevel:
>>> df
A B
1 2 3 1 2 3
11/12/2021 1 2 3 4 5 6
>>> df.stack(level=0).swaplevel()
1 2 3
A 11/12/2021 1 2 3
B 11/12/2021 4 5 6

