-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
API: Remove kwargs from GroupBy #29511
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
Conversation
cd4bc8a
to
a03460b
Compare
pandas/core/generic.py
Outdated
Optional, only accepts keyword argument 'mutated' and is passed | ||
to groupby. | ||
mutated : bool, False | ||
`mutated` is passed to groupby. |
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.
I'm not sure what mutated
actually does. It's tested for in window/test_grouper.py
so assume it has something to do with windowing ops. anyone got a suggestion for a better doc string?
a03460b
to
6d153c4
Compare
generally +1. im also unclear on the mutated thing. I epxect we dont want users passing it directly, wondering if it can be kept out of the top-level method signature |
It is already allowed in the top-level signature, it's just hidden, so it would have to go through a deprecation process. But else I agree. |
I am actually -1 on this change; unfortunate that we accept kwargs here but mutated is entirely an internal construction. I don't think we should expose it out as part of the GroupBy API |
If mutated is internal, I think it should not be in the |
pandas/core/generic.py
Outdated
@@ -7829,7 +7829,7 @@ def groupby( | |||
group_keys=True, | |||
squeeze=False, | |||
observed=False, | |||
**kwargs | |||
mutated=False, |
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 changing a public API. The reason the kwargs was added was to work around some internal routines calling this. So I wouldn't do this; rather we can work on cleaning how this is called to avoid passing thru here.
e926495
to
a7f1ead
Compare
a7f1ead
to
46d2245
Compare
I've made a few changes:
It didn't seem that any internal functionality actually used |
why would you deprecate? it is not public |
If this is correct, we could also directly remove it? (it has never been publicly exposed, only hidden in the kwargs, so I don't think a user could ever have known to pass a |
Ok, I've removed |
5d6e070
to
2f0aa75
Compare
2f0aa75
to
d590eb9
Compare
thanks @topper-123 nice clean |
Remove kwargs from
_GroupBy`.__init__
and adds an explicitmutated
parameter name instead. Also makes related changes.Avoiding kwargs when possible is better for typing ergonomics.