# xarray.Coordinates.from_pandas_multiindex

#### *classmethod* Coordinates.from_pandas_multiindex(midx, dim)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/coordinates.py#L404-L430)

Wrap a pandas multi-index as Xarray coordinates (dimension + levels).

The returned coordinate variables can be directly assigned to a
[`Dataset`](xarray.Dataset.html.md#xarray.Dataset) or [`DataArray`](xarray.DataArray.html.md#xarray.DataArray) via the
`coords` argument of their constructor.

* **Parameters:**
  * **midx** ([`pandas.MultiIndex`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.MultiIndex.html#pandas.MultiIndex)) – Pandas multi-index object.
  * **dim** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Dimension name.
* **Returns:**
  **coords** ([`Coordinates`](xarray.Coordinates.html.md#xarray.Coordinates)) – A collection of Xarray indexed coordinates created from the multi-index.
