issues: 207477701
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
207477701 | MDU6SXNzdWUyMDc0Nzc3MDE= | 1267 | "in" operator does not work as expected on DataArray dimensions | 5629061 | closed | 0 | 2856429 | 2 | 2017-02-14T10:35:41Z | 2018-10-28T17:56:17Z | 2018-10-28T17:56:17Z | NONE | As an example I have a DataArray called "my_dataarray" that looks something like this:
'Type' is a dimension on my DataArray. Note that 'Type' is also a DataArray that looks like this:
Let's say I run:
The result is False, even though 'Type 1' is in the "Type" dimension. To get the result I was expecting I need to run:
Stepping through the code, the problematic line is here: https://github.com/pydata/xarray/blob/20ec32430fac63a8976699d9528b5fdc1cd4125d/xarray/core/dataarray.py#L487 The test used for This is probably the right thing to do when the DataArray is used for storing data, but probably not what we want if the DataArray is being used as a dimension - it should instead check if 'Type 1' is in the values of Type? |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/1267/reactions", "total_count": 1, "+1": 1, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |