issues: 866530388
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
866530388 | MDU6SXNzdWU4NjY1MzAzODg= | 5214 | When try to assign a pd.MultiIndex to the coords, the behavior is different between "Dimension coordinate" and "Non-dimension coordinate" | 38346144 | closed | 0 | 3 | 2021-04-24T02:47:15Z | 2021-09-15T11:04:57Z | 2021-09-15T11:04:57Z | NONE | Bug reports that follow these guidelines are easier to diagnose, and so are often handled much more quickly. --> What happened: When I try to assign an instance of pd.MultiIndex to the coords: the behavior of "Dimension coordinate" is to maintain the multi-index so I can use multi-index levels directly as keyword arguments, while the behavior of "Non-dimension coordinate" is to change the index to an np.ndarray with dtype "object" , that make above function failed. What you expected to happen: I want the "Non-dimension coordinate" can also maintain the multi-index Minimal Complete Verifiable Example: ```python
create a dataarray named 'arr'
add coords 'z1' in dim 'z'this time 'z1' is a "Non-dimension coordinate"
let the coords 'z1' to be the z's coords
let's see what's coords 'z' look like
why 'z' is not a MultiIndex ???now 'z' is a "Dimension coordinate"set the coords again
let's see what's coords 'z' look like
'z' is successfully setted to a MultiIndex``` Anything else we need to know?: Environment: Output of <tt>xr.show_versions()</tt>INSTALLED VERSIONS ------------------ commit: None python: 3.8.2 (default, Mar 25 2020, 17:03:02) [GCC 7.3.0] python-bits: 64 OS: Linux OS-release: 5.10.27-gentoo-dist machine: x86_64 processor: byteorder: little LC_ALL: None LANG: C.UTF-8 LOCALE: en_US.UTF-8 libhdf5: 1.10.4 libnetcdf: None xarray: 0.17.0 pandas: 1.2.4 numpy: 1.20.2 scipy: 1.6.2 netCDF4: None pydap: None h5netcdf: None h5py: 2.10.0 Nio: None zarr: None cftime: 1.4.1 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: 0.9.8.5 iris: None bottleneck: None dask: 2021.04.0 distributed: 2021.04.0 matplotlib: 3.4.1 cartopy: 0.18.0 seaborn: 0.11.1 numbagg: None pint: None setuptools: 49.6.0.post20210108 pip: 21.0.1 conda: 4.10.1 pytest: None IPython: 7.22.0 sphinx: None |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/5214/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |