I have a problem in which I am trying to change the shape of data, but trying to have column names on row level without having suffixes attached to them.
e.g.
My original df looks like this
+------+--------+--------+--------+--------+--------+--------+
| Year | col1_a | col2_a | col3_a | col1_b | col2_b | col3_b |
+------+--------+--------+--------+--------+--------+--------+
| 2017 | 1.4 | 555 | 5 | 123 | 55.5 | 80 |
| 2018 | 1.5 | 444 | 6 | 456 | 56.5 | 90 |
| 2019 | 0.6 | 333 | 8 | 789 | 57.5 | 100 |
+------+--------+--------+--------+--------+--------+--------+
and I am trying to reshape it as
+------+------+------+------+------+------+------+
| | a | a | a | b | b | b |
+------+------+------+------+------+------+------+
| 2017 | 2018 | 2019 | 2017 | 2018 | 2019 |
| col1 | 1.4 | 1.5 | 0.6 | 123 | 456 | 789 |
| col2 | 555 | 444 | 333 | 55.5 | 56.5 | 57.5 |
| col3 | 5 | 6 | 8 | 80 | 90 | 100 |
+------+------+------+------+------+------+------+
I can use pivot_table but the thing is I am not able to get unique column names at index level. Any idea which method can be used to reshape this?