issues: 955617411
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
955617411 | MDU6SXNzdWU5NTU2MTc0MTE= | 5646 | Level names in multi-level index are ignored | 688461 | closed | 0 | 3 | 2021-07-29T08:56:48Z | 2022-09-27T12:34:21Z | 2022-09-27T12:34:20Z | NONE | What happened: The difference of the level names in multi-level index is silently ignored. What you expected to happen: Error message. Minimal Complete Verifiable Example: ```python import xarray as xr a = xr.DataArray([[1]], dims = ["x", "y"]) b = a.stack({"z": ["x", "y"]}) c = a.rename({"x": "not-x", "y": "not-y"}).stack({"z": ["not-x", "not-y"]}) xr.testing.assert_allclose(b, c) print(b == c, "\n") print(b.coords == c.coords, "\n") print(b + c, "\n") print(c + b, "\n") ``` Output: ``` <xarray.DataArray (z: 1)> array([ True]) Coordinates: * z (z) MultiIndex - x (z) int64 0 - y (z) int64 0 True <xarray.DataArray (z: 1)> array([2]) Coordinates: * z (z) MultiIndex - x (z) int64 0 - y (z) int64 0 <xarray.DataArray (z: 1)> array([2]) Coordinates: * z (z) MultiIndex - not-x (z) int64 0 - not-y (z) int64 0 ``` Environment: Output of <tt>xr.show_versions()</tt>INSTALLED VERSIONS ------------------ commit: None python: 3.9.1 (tags/v3.9.1:1e5d33e, Dec 7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)] python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: Intel64 Family 6 Model 165 Stepping 5, GenuineIntel byteorder: little LC_ALL: None LANG: ru_RU.UTF-8 LOCALE: ('Russian_Russia', '1251') libhdf5: 1.12.0 libnetcdf: None xarray: 0.18.2 pandas: 1.3.0 numpy: 1.21.1 scipy: 1.6.0 netCDF4: None pydap: None h5netcdf: None h5py: 3.1.0 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: 3.4.2 cartopy: None seaborn: None numbagg: None pint: None setuptools: 57.4.0 pip: 21.1.3 conda: None pytest: None IPython: None sphinx: None |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/5646/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |