xarray.Coordinates.from_pandas_multiindex

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 or DataArray via the coords argument of their constructor.

Parameters:
Returns:

coords (Coordinates) – A collection of Xarray indexed coordinates created from the multi-index.