Closed
Description
xref #1542
This appears when using the development version of pandas:
In [7]: import pandas as pd
In [8]: pd.Series(range(5))
Out[8]:
0 0
1 1
2 2
3 3
4 4
dtype: int64
In [9]: pd.Series(range(5)).to_xarray().to_series()
Out[9]:
index
0 0
1 1
2 2
3 3
4 4
dtype: int64
In [10]: pd.Series(range(5)).to_xarray().to_series().index
Out[10]:
MultiIndex(levels=[[0, 1, 2, 3, 4]],
labels=[[0, 1, 2, 3, 4]],
names=['index'])
I think the problem boils down to these lines:
xarray/xarray/core/coordinates.py
Lines 52 to 58 in 78ca20a
We really want a normal Index for the coordinates from 1D data, not a MultiIndex. MultiIndex.from_product
used to return different types depending on how it was called, but in pandas-dev/pandas#17236 it was fixed to always return a MultiIndex
.
Metadata
Metadata
Assignees
Labels
No labels