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 coordinates can be directly assigned to a
DatasetorDataArrayvia thecoordsargument 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.