issues: 1923361961
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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1923361961 | I_kwDOAMm_X85ypCyp | 8263 | Surprising `.groupby` behavior with float index | 5635139 | closed | 0 | 0 | 2023-10-03T05:50:49Z | 2024-01-08T01:05:25Z | 2024-01-08T01:05:25Z | MEMBER | What is your issue?We raise an error on grouping without supplying dims, but not for float indexes — is this intentional or an oversight?
```python da = xr.tutorial.open_dataset("air_temperature")['air'] da.drop_vars('lat').groupby('lat').sum() ``` ```ValueError Traceback (most recent call last) Cell In[8], line 1 ----> 1 da.drop_vars('lat').groupby('lat').sum() ... ValueError: cannot reduce over dimensions ['lat']. expected either '...' to reduce over all dimensions or one or more of ('time', 'lon'). ``` But with a float index, we don't raise:
...returns the original array:
And if we try this with a non-float index, we get the error again:
|
{
"url": "https://api.github.com/repos/pydata/xarray/issues/8263/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} |
completed | 13221727 | issue |