Repository navigation
Make groupby/resample args keyword-only, start groupby_bins deprecation - #11744
Merged
Merged
Conversation
…cation Passing keyword-only args of groupby and resample positionally has warned since v2024.07.0 (pydata#9236) and now raises a TypeError. groupby_bins had the decorator but no `*`, so it never warned; add the `*` so the deprecation actually starts. Part of pydata#11721. Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
headtr1ck
approved these changes
Oct 16, 2026
| return DatasetGroupBy(self, rgroupers, restore_coord_dims=restore_coord_dims) | ||
|
|
||
| @_deprecate_positional_args("v2024.07.0") | ||
| @_deprecate_positional_args("v2026.09.1") |
Collaborator
There was a problem hiding this comment.
Suggested change
| @_deprecate_positional_args("v2026.09.1") | |
| @_deprecate_positional_args("v2026.10.0") |
It's already october.
Collaborator
|
Would you mind ticking the ai box in the PR description? |
headtr1ck
enabled auto-merge (squash)
October 18, 2026 18:08
Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR finishes the positional-argument deprecation from #9236 for
groupbyandresample, and starts it forgroupby_bins. It covers the "Make the deprecated positional args ofgroupby,groupby_bins,resamplekeyword-only" item in #11721.Dataset/DataArray.groupbyand.resample: removed@_deprecate_positional_args("v2024.07.0"). Their signatures already have a*, so passing keyword-only args positionally now raises aTypeError. The deprecation message promised this "two releases later".Dataset/DataArray.groupby_bins: groupby, resample: Deprecate some positional args #9236 added the decorator here but not the*, so it never fired. I added*afterbins, which makes the decorator start warning, and changed its version tov2026.09.1, the current unreleased version, so the message is accurate. Turning this straight into an error would break users who were never warned, so it's listed under Deprecations instead of Breaking Changes. If you'd rather makegroupandbinsthe only positional parameters some other way, or skip the cycle, I'm happy to change it.In
test_multiple_groupers_string, thepytest.warns(FutureWarning)aroundobj.groupby("labels1", "labels2")is now justpytest.raises(TypeError). The newtest_keyword_only_argscovers all three methods for bothDatasetandDataArray.Checklist
whats-new.rstAI Disclosure
Tools: Claude Code
[This is Claude Code on behalf of Mohansree Vijayakumar]