Is there a way to swap multiple levels of a multiIndex dataframe at once?
I basically need to roll the position of my multiIndex such that I go from:
myIndexLevels= (0 ,1 ,2)
to:
myNewIndexLevels= (1 ,2, 0)
I know I can use swaplevel twice but I am quite sure there is a better way.
This is my solution as of now:
df.index.swaplevel(0,1).swaplevel(1,2)