issues: 588821932
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
588821932 | MDU6SXNzdWU1ODg4MjE5MzI= | 3899 | _indexes of DataArray are not deep copied | 2272878 | closed | 0 | 4 | 2020-03-27T01:19:07Z | 2020-03-29T02:01:20Z | 2020-03-29T02:01:20Z | CONTRIBUTOR | In MCVE Code Sample```python a0 = xr.DataArray( np.array([[1, 2, 3], [4, 5, 6]]), dims=["y", "x"], coords={"x": ["a", "b", "c"], "y": [-1, 1]}, ) a1 = a0.copy() del a1.coords["y"] xr.tests.assert_identical(a0, a0) ``` The result is: ``` xarray/testing.py:272: in _assert_internal_invariants _assert_dataarray_invariants(xarray_obj) xarray/testing.py:222: in _assert_dataarray_invariants _assert_indexes_invariants_checks(da._indexes, da._coords, da.dims) indexes = {'x': Index(['a', 'b', 'c'], dtype='object', name='x')}, possible_coord_variables = {'x': <xarray.IndexVariable 'x' (x: 3)> array(['a', 'b', 'c'], dtype='<U1'), 'y': <xarray.IndexVariable 'y' (y: 2)> array([-1, 1])} dims = ('y', 'x')
xarray/testing.py:185: AssertionError ``` Expected OutputThe test should pass. Problem DescriptionDoing a deep copy should make a copy of everything. Changing a deep copy should not alter the original in any way. |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/3899/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |