home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 1168748727

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
1168748727 I_kwDOAMm_X85FqbC3 6356 Re-indexing doesn't preserve coord name for `DataArray.to_dataframe` calls 21366877 closed 0     1 2022-03-14T18:21:41Z 2022-03-21T08:08:09Z 2022-03-21T08:08:09Z NONE      

What happened?

Re-indexing doesn't preserve coord name for DataArray.to_dataframe calls. The resulting dataframe's index name is None.

What did you expect to happen?

In xarray 0.14 the name is preserved after reindex.

Minimal Complete Verifiable Example

```Python 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) ```

Relevant log output

Python ['a'] [None]

Anything else we need to know?

No response

Environment

```

/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

```

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/6356/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 2 rows from issues_id in issues_labels
  • 1 row from issue in issue_comments
Powered by Datasette · Queries took 0.582ms · About: xarray-datasette