-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Add support for *args
in apply-like functions.
#48582
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
Comments
Take |
Are the functions mentioned on the description (like Series/DataFrame.apply, DataFrame.applymap...) the only places where we need to apply the code on the solution? Also, is there any possibility to show some examples where I can test these functions? It's just to make sure the code is working properly after the modifications. |
@Pvlb1998 just a heads up, please wait for confirmation from members of the core team regarding support of this functionality before moving forward. |
@mroeschke Oh it's alright! Even if this function doesn't properly work, I would still like to work on it purely for learning (doesn't have to be aproved). But even after making some modifications I still don't know how to test it. If it's possible, could you provide some cases of test so I can at least check if there's anything wrong with my modifications? |
This looks like a duplicate of #40112 |
Yep agreed, closing then |
Feature Type
Adding new functionality to pandas
Changing existing functionality in pandas
Removing existing functionality in pandas
Problem Description
I think it would be nice if all the various
apply
-like functions had the same way to pass extra arguments for the applied function.The state now is as follows:
Series/DataFrame.apply
- can accept**kwargs
, but to pass non-keyword argument there you pass a tupleargs
, instead of*args
.DataFrame.applymap
- can accept**kwargs
, but there is no way to pass non-keyword arguments.Index/Series.map
- no way to pass any additional arguments.GroupBy.apply
- can pass arguments using*args, **kwargs
.GroupBy/Series/DataFrame.transform
- can pass arguments using*args, **kwargs
.I think that the
*args, **kwargs
way is the cleanest, so I propose to change the implementation of all other cases to conform to it.I also think that passing extra arguments to
Series/DataFrame.apply
using theargs
tuple should be deprecated (but while you have both options they should be mutually exclusive).Feature Description
The implementation seems easy enough/already exists in most cases.
For example in the
Series.apply
case:Alternative Solutions
As I said, it seems that in many places this change is already implemented and just needs to be applied everywhere.
Additional Context
No response
The text was updated successfully, but these errors were encountered: