reorder_levels

UnitsAwareDataArray.reorder_levels(dim_order: Mapping[Any, Sequence[int | Hashable]] | None = None, **dim_order_kwargs: Sequence[int | Hashable]) Self

Rearrange index levels using input order.

Parameters:
  • Hashable (dim_order dict-like of Hashable to int or) – Mapping from names matching dimensions and values given by lists representing new level orders. Every given dimension must have a multi-index.

  • **dim_order_kwargs (optional) – The keyword arguments form of dim_order. One of dim_order or dim_order_kwargs must be provided.

Returns:

obj – Another dataarray, with this dataarray’s data but replaced coordinates.

Return type:

DataArray