xarray.Coordinates.from_pandas_multiindex#
- classmethod Coordinates.from_pandas_multiindex(midx, dim)[source]#
Wrap a pandas multi-index as Xarray coordinates (dimension + levels).
The returned coordinate variables can be directly assigned to a
Dataset
orDataArray
via thecoords
argument of their constructor.- Parameters:
midx (
pandas.MultiIndex
) – Pandas multi-index object.dim (
str
) – Dimension name.
- Returns:
coords (
Coordinates
) – A collection of Xarray indexed coordinates created from the multi-index.