home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 1240463387

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/pull/7004#issuecomment-1240463387 https://api.github.com/repos/pydata/xarray/issues/7004 1240463387 IC_kwDOAMm_X85J7_gb 4160723 2022-09-08T09:28:25Z 2022-09-08T09:28:25Z MEMBER

it is now allowed to provide array-like labels.

Hmm not sure if it's a good idea... I find get_locs() a bit confusing like in the example below where a 4-labels array for level "one" returns a 3-items location integer array:

```python

is the 3rd label ("b") ignored?

midx.get_locs((np.array(["b", "a", "b", "c"]), 0))

array([4, 0, 8])

```

That differs too much from the vectorized selection based on single pandas indexes...

Fancy indexing with n-d label arrays doesn't work either:

```python midx.get_locs((np.array([["a", "a"], ["a", "a"]]), 0))

InvalidIndexError: [['a' 'a']

['a' 'a']]

```

And providing Variable or DataArray objects as labels would make things event harder, unless we ignore their dimension names and coordinates (but then it wouldn't be consistent with vectorized selection based on single pandas indexes).

Probably not worth it then?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  1364798843
Powered by Datasette · Queries took 0.673ms · About: xarray-datasette