datatree.DataTree.reorder_levels#
- DataTree.reorder_levels(dim_order: collections.abc.Mapping[Any, collections.abc.Sequence[int | collections.abc.Hashable]] | None = None, **dim_order_kwargs: collections.abc.Sequence[int | collections.abc.Hashable]) Self [source]#
Rearrange index levels using input order.
- Parameters
dim_order (dict-like of
Hashable
toSequence
ofint
orHashable
, optional) – 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 (
Sequence
ofint
orHashable
, optional) – The keyword arguments form ofdim_order
. One of dim_order or dim_order_kwargs must be provided.
- Returns
obj (
Dataset
) – Another dataset, with this dataset’s data but replaced coordinates.