home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 370960004

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
370960004 MDU6SXNzdWUzNzA5NjAwMDQ= 2489 Renaming a coordinate of a multi-index after stack fails 16508140 closed 0     3 2018-10-17T08:40:04Z 2022-03-17T17:11:41Z 2022-03-17T17:11:41Z NONE      

Code Sample, a copy-pastable example if possible

```python import numpy as np import xarray as xr

da = xr.DataArray(np.arange(np.prod(dims)).reshape(*dims), coords=[('dim0', np.arange(dims[0])), ('dim1', np.arange(dims[0]) + 2)]) daStacked = da.stack(dim0_dim1=['dim0', 'dim1'])

daStacked.rename(dim1='foo') ```

Problem description

'dim1' is indeed neither a variable nor a dimension, since the only dimension is now 'dim0_dim1'. Is there a good reason to limit the possibility to rename to dimensions rather than all coordinates?

Expected Output

ValueError: cannot rename 'dim1' because it is not a variable or dimension in this dataset

Output of xr.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.6.6.final.0 python-bits: 64 OS: Linux OS-release: 2.6.32-696.20.1.el6.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: fr_FR.UTF-8 LOCALE: fr_FR.UTF-8 xarray: 0.10.8 pandas: 0.23.4 numpy: 1.15.0 scipy: 1.1.0 netCDF4: 1.4.0 h5netcdf: None h5py: None Nio: None zarr: None bottleneck: 1.2.1 cyordereddict: None dask: 0.18.2 distributed: None matplotlib: 2.2.2 cartopy: None seaborn: None setuptools: 40.0.0 pip: 18.0 conda: None pytest: None IPython: 6.5.0 sphinx: None
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2489/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

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