Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support .groupby(['foo', 'bar']) as sugar for .groupby(foo=UniqueGrouper(), bar=UniqueGrouper()) #9396

Closed
dcherian opened this issue Aug 22, 2024 · 3 comments · Fixed by #9414

Comments

@dcherian
Copy link
Contributor

Once #9372 goes in we will support grouping by multiple variables.

@max-sixty makes a good point re: ergonomics:

I missed previous discussions / can decide this later — but do we want to have da.groupby(['foo', 'bar']) as sugar for da.groupby(foo=UniqueGrouper(), bar=UniqueGrouper())?

Originally posted by @max-sixty in #9372 (comment)

I think this would be great. da.groupby(foo=UniqueGrouper(), bar=UniqueGrouper()) is a bit too much typing for a very simple expression.

@dcherian
Copy link
Contributor Author

@max-sixty are you able to do this?

@max-sixty
Copy link
Collaborator

I can try to have a look at the weekend

(I realize I'm in your debt but generally when I commit to things, I end up not doing them, so I won't commit here. But would like to reciprocate some of your recent work and agree it makes sense for me to take it)

@dcherian
Copy link
Contributor Author

no pressure! ;)

dcherian added a commit to dcherian/xarray that referenced this issue Aug 30, 2024
dcherian added a commit to dcherian/xarray that referenced this issue Aug 30, 2024
hollymandel pushed a commit to hollymandel/xarray that referenced this issue Sep 23, 2024
* Group by multiple strings

Closes pydata#9396

* Fix typing

* some more

* fix

* cleanup

* Update xarray/core/dataarray.py

* Update docs

* Revert "Update xarray/core/dataarray.py"

This reverts commit fafd960.

* update docstring

* Add docstring examples

* Update xarray/core/dataarray.py

Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>

* Update xarray/core/dataset.py

* fix assert warning / error

* fix assert warning / error

* Silence RTD warnings

---------

Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>
Co-authored-by: Maximilian Roos <m@maxroos.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants