home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 59308959

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
59308959 MDU6SXNzdWU1OTMwODk1OQ== 343 DataArrays initialized with the same data behave like views of each other 7462311 closed 0   799013 2 2015-02-27T23:19:39Z 2015-03-03T06:02:56Z 2015-03-03T06:02:56Z NONE      

I'm not sure if this qualifies as a bug but this behavior was surprising to me. If I initialize two DataArrays with the same array, the two DataArrays and the original initialization array are all linked as if they are views of each other.

A simple example:

``` Python

initialize with same array:

a = np.zeros((4,4)) da1 = xray.DataArray(a, dims=['x', 'y']) da2 = xray.DataArray(a, dims=['i', 'j']) ```

If I do da1.loc[:, 2] = 12, the same change occurs in da2 and a. Likewise, doing da2[dict(i=1)] = 29 also modifies da1 and a.

The problem is fixed if I explicitly pass copies of the a but I think this should be the default behavior. If this behavior is intended then I think it should be clearly noted in the documentation.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/343/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
  • 2 rows from issue in issue_comments
Powered by Datasette · Queries took 78.994ms · About: xarray-datasette