We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DataArray.to_dataframe
Re-indexing doesn't preserve coord name for DataArray.to_dataframe calls. The resulting dataframe's index name is None.
None
In xarray 0.14 the name is preserved after reindex.
import numpy as np import xarray as xr da = xr.DataArray(np.arange(5), dims=["a"], name="da", coords={"a": np.arange(5)}) print(da.to_dataframe().index.names) print(da.reindex({"a": np.arange(5)}).to_dataframe().index.names)
['a'] [None]
No response
/space/aostow/envs/xr2022/lib/python3.10/site-packages/_distutils_hack/__init__.py:30: UserWarning: Setuptools is replacing distutils. warnings.warn("Setuptools is replacing distutils.") INSTALLED VERSIONS ------------------ commit: None python: 3.10.2 | packaged by conda-forge | (main, Mar 8 2022, 15:53:57) [GCC 9.4.0] python-bits: 64 OS: Linux OS-release: 3.10.0-1160.53.1.el7.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: en_US.UTF-8 LANG: en_US.UTF-8 LOCALE: ('en_US', 'UTF-8') libhdf5: None libnetcdf: None xarray: 2022.3.0 pandas: 1.4.1 numpy: 1.22.3 scipy: None netCDF4: None pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: None nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: None distributed: None matplotlib: None cartopy: None seaborn: None numbagg: None fsspec: None cupy: None pint: None sparse: None setuptools: 60.9.3 pip: 22.0.4 conda: None pytest: None IPython: 8.0.1 sphinx: None
The text was updated successfully, but these errors were encountered:
Looks like it has been fixed in #5692. The main branch outputs:
['a'] ['a']
Sorry, something went wrong.
No branches or pull requests
What happened?
Re-indexing doesn't preserve coord name for
DataArray.to_dataframe
calls. The resulting dataframe's index name isNone
.What did you expect to happen?
In xarray 0.14 the name is preserved after reindex.
Minimal Complete Verifiable Example
Relevant log output
Anything else we need to know?
No response
Environment
The text was updated successfully, but these errors were encountered: