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 2021856935,PR_kwDOAMm_X85g81gb,8509,Proof of concept - public Grouper objects,2448579,open,0,,,0,2023-12-02T04:52:27Z,2024-03-15T05:18:18Z,,MEMBER,,1,pydata/xarray/pulls/8509,"Not for merging, just proof that it can be done nicely :) Now builds on #8840 ~Builds on an older version of #8507~ Try it out! ```python import xarray as xr from xarray.core.groupers import SeasonGrouper, SeasonResampler ds = xr.tutorial.open_dataset(""air_temperature"") # custom seasons! ds.air.groupby(time=SeasonGrouper([""JF"", ""MAM"", ""JJAS"", ""OND""])).mean() ds.air.resample(time=SeasonResampler([""DJF"", ""MAM"", ""JJAS"", ""ON""])).count() ```","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/8509/reactions"", ""total_count"": 2, ""+1"": 2, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 2021858121,PR_kwDOAMm_X85g81wJ,8510,Grouper object design doc,2448579,closed,0,,,6,2023-12-02T04:56:54Z,2024-03-06T02:27:07Z,2024-03-06T02:27:04Z,MEMBER,,0,pydata/xarray/pulls/8510,"xref #8509, #6610 **Rendered version** [here](https://github.com/dcherian/xarray/blob/grouper-proposal/design_notes/grouper_objects.md) ----- @pydata/xarray I've been poking at this on and off for a year now and finally figured out how to do it cleanly (#8509). I wrote up a design doc for `Grouper` objects that allow custom conversion of DataArrays to integer group codes, following the NEP template (which is absolutely great!). Such Grouper objects allow us to generalize the GroupBy interface to a much larger class of problems, and eventually provide a nice path to grouping by multiple variables (#6610) #8509 implements two custom Groupers for you to try out :) ```python import xarray as xr from xarray.core.groupers import SeasonGrouper, SeasonResampler ds = xr.tutorial.open_dataset(""air_temperature"") # custom seasons! ds.air.groupby(time=SeasonGrouper([""JF"", ""MAM"", ""JJAS"", ""OND""])).mean() ds.air.resample(time=SeasonResampler([""DJF"", ""MAM"", ""JJAS"", ""ON""])).count() ``` All comments are welcome, 1. there are a couple of specific API and design decisions to be made. I'll make some comments pointing these out. 2. I'm also curious about what `Grouper` objects we should provide in Xarray. ----- cc @ilan-gold @ivirshup @aulemahal @tomvothecoder @jbusecke @katiedagon - it would be good to hear what ""Groupers"" would be useful for your work / projects. I bet you already have examples that fit this proposal","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/8510/reactions"", ""total_count"": 8, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 8, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 2021763059,PR_kwDOAMm_X85g8iNJ,8507,Deprecate `squeeze` in GroupBy.,2448579,closed,0,,,2,2023-12-02T00:21:43Z,2024-01-08T03:08:47Z,2024-01-08T01:05:23Z,MEMBER,,0,pydata/xarray/pulls/8507,"- [x] xref #2157, xref #1460 - [x] Closes #8518, closes #8263 - [x] Tests added - [x] User visible changes (including notable bug fixes) are documented in `whats-new.rst` ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/8507/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 2021754904,PR_kwDOAMm_X85g8gnU,8506,Deprecate `squeeze` in GroupBy.,2448579,closed,0,,,1,2023-12-02T00:08:50Z,2023-12-02T00:13:36Z,2023-12-02T00:13:36Z,MEMBER,,0,pydata/xarray/pulls/8506,"- [x] Closes #2157 - [ ] Tests added - [x] User visible changes (including notable bug fixes) are documented in `whats-new.rst` Could use a close-ish review.","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/8506/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull