pandas.DataFrame.reorder_levels

DataFrame.reorder_levels(self, order, axis=0) → 'DataFrame'[source]

Rearrange index levels using input order. May not drop or duplicate levels.

Parameters
orderlist of int or list of str

List representing new level order. Reference level by number (position) or by key (label).

axisint

Where to reorder levels.

Returns
DataFrame