-
-
Notifications
You must be signed in to change notification settings - Fork 145
allow args and kwargs in groupby.apply #1268
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
Thank you! |
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.
Two small optional changes (happy to merge without them):
include_groups
is not deprecated, onlyinclude_groups=True
, I would be fine keeping the test and addinginclude_groups: Literal[False]
in the signature- it might be nice to have a test where a kwargs/args is incompatible with the
func
Yes, but there are 2 issues with that.
Yes, although I'm not sure how to write one! I just wanted to handle the use case reported. |
Thank you for the explanations!
Something like df.groupby("group", group_keys=False)[["group", "value"]].apply(
add_constant_to_mean, constant="5" # typing: ignore
) should hopefully be flagged as wrong. |
Thanks for the suggestion. I've incorporated into the last commit |
Thanks @Dr-Irv ! |
error: No overloads for "apply" match the provided arguments (reportCallIssue)
#1266(test_groupby.py:test_dataframe_apply_kwargs()