issues: 923355397
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
923355397 | MDExOlB1bGxSZXF1ZXN0NjcyMTI5NzY4 | 5480 | Implement weighted groupby | 2448579 | open | 0 | 1 | 2021-06-17T02:57:17Z | 2023-07-27T18:09:55Z | MEMBER | 1 | pydata/xarray/pulls/5480 |
Initial proof-of-concept. Suggestions to improve this are very welcome. Here's some convenient testing code
``` python ds = xr.tutorial.open_dataset('rasm').load() month_length = ds.time.dt.days_in_month weights = month_length.groupby('time.season') / month_length.groupby('time.season').sum() actual = ds.weighted(month_length).groupby("time.season").mean() expected = (ds * weights).groupby('time.season').sum(skipna=False) xr.testing.assert_allclose(actual, expected) ``` I've added info to the repr
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/5480/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
13221727 | pull |