pandas.Series.reorder_levels

pandas 3.1.1 · Series and accessors · method

Rearrange levels of a hierarchical index.

Call syntax

Series.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 representing new level order

Specify the order in which levels or values should appear.

Returns

Series