issues: 537934462
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
537934462 | MDU6SXNzdWU1Mzc5MzQ0NjI= | 3621 | ".indexes" not updated when setting values through ".values" | 1277781 | closed | 0 | 1 | 2019-12-14T16:27:27Z | 2019-12-16T18:38:10Z | 2019-12-16T18:38:10Z | CONTRIBUTOR | MCVE Code Sample```python import xarray as xr da1 = xr.DataArray([1,2],dims=['x'],coords={'x':[0,1]}) print(da1.indexes) da1['x'].values = [1,2] print(da1.indexes) print('--------') print(da1['x'])
Expected Output```python x: Int64Index([0, 1], dtype='int64', name='x') x: Int64Index([1, 2], dtype='int64', name='x') <xarray.DataArray 'x' (x: 2)> array([1, 2]) Coordinates: * x (x) int32 1 2 ``` Problem Description
The issue does not occur if I
a, either do not call ".indexes" before setting the value, or
b, call Output of
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/3621/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |