pandas.MultiIndex.reorder_levels

pandas 3.1.1 · Index objects · method

Rearrange levels of a hierarchical index.

Call syntax

MultiIndex.reorder_levels(order)

Run the example

Edit the example and select Run Python to see the result.

Parameters

ParameterRequirementAccepted values and behavior
order Required
Positional or keyword
list of int or list of str

Specify the order in which levels or values should appear.

Returns

MultiIndex