-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
GroupBy(multiple groupers) #9372
Conversation
@max-sixty I could use some help with adding tests,docs,docstrings if you have time :) |
8701e9b
to
aa52ce6
Compare
@@ -410,6 +382,58 @@ def _resolve_group( | |||
return newgroup | |||
|
|||
|
|||
@dataclass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the main new logic.
While trying to help with pydata#9372, I realize the error message for this could be much better, and so putting this PR in as some penance for my tardiness in helping there
I had a look at where I add something — it already seems extremely good? I missed previous discussions / can decide this later — but do we want to have |
* Improve error message on `ds['x', 'y']` While trying to help with #9372, I realize the error message for this could be much better, and so putting this PR in as some penance for my tardiness in helping there * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Yes it is surprisingly complete. A section in the narrative docs would be nice to add. |
I agree. It's a bit too much typing at the moment |
414f95a
to
b28a3fa
Compare
2514e90
to
da23871
Compare
fix docs [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci
da23871
to
7ec2341
Compare
* main: Extend padding functionalities (pydata#9353)
EDIT: Now raises NotImplementedError for this case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is huge! Thank you very much @dcherian !
Merging so it's ready to try out! |
Huge success! Thank you @dcherian ! |
Wow, amazing work @dcherian! I am so excited to see this finally land. |
* GroupBy(multiple groupers) * Add example to docs fix docs [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix docs * More docs * fix doc * fix doc again * Fix bug. * Add whats-new note * edit * Error on multi-variable groupby with MultiIndex * Update doc/user-guide/groupby.rst --------- Co-authored-by: Maximilian Roos <m@maxroos.com>
* main: Accessibility: Add keyboard handling for XArray HTML view (pydata#9412) [pre-commit.ci] pre-commit autoupdate (pydata#9316) [skip-ci] Speed up docs build by limiting toctrees (pydata#9395) fix the failing `pre-commit.ci` runs (pydata#9411) Update benchmarks.yml (pydata#9406) GroupBy(multiple groupers) (pydata#9372) Encode/decode property tests use variables() (pydata#9401)
Builds on #9389
whats-new.rst
api.rst
This PR takes an approach similar to that in #924.
The GroupBy(multiple array) problem can be reduced to the GroupBy(single nD variable) problem:
by
array to integer codes ("factorize"). I do this first because factorization is expensive, and so it's cheaper to do it before any possible broadcasting.np.ravel_multi_index
them to construct a single nD array of integer codes.group==1
without inserting a missing value ifgroup
is:TODO: