xarray.DataArray.reorder_levels

DataArray.reorder_levels(self, dim_order: Union[Mapping[Hashable, Sequence[int]], NoneType] = None, inplace: Union[bool, NoneType] = None, **dim_order_kwargs: Sequence[int]) → Union[ForwardRef('DataArray'), NoneType]

Rearrange index levels using input order.

Parameters
dim_orderoptional

Mapping from names matching dimensions and values given by lists representing new level orders. Every given dimension must have a multi-index.

inplacebool, optional

If True, modify the dataarray in-place. Otherwise, return a new DataArray object.

**dim_order_kwargs: optional

The keyword arguments form of dim_order. One of dim_order or dim_order_kwargs must be provided.

Returns
objDataArray

Another dataarray, with this dataarray’s data but replaced coordinates. If inplace == True, return None.