pandas.DataFrame.swaplevel

DataFrame.swaplevel(self, i=- 2, j=- 1, axis=0) → ’DataFrame’[source]

Swap levels i and j in a MultiIndex on a particular axis.

Parameters
i, jint or str

Levels of the indices to be swapped. Can pass level name as string.

Returns
DataFrame