-
-
Notifications
You must be signed in to change notification settings - Fork 18.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
ENH: Type pipe
with ParamSpec
#56359
Comments
I think it would be best first to have a pandas-stubs PR (with typing tests) and after that is merged and works well a pandas PR. |
I agree. The goal is to improve type checking for users, which is why we have Also, see pandas-dev/pandas-stubs#738 |
Alright, sounds good. I'll continue this in pandas-dev/pandas-stubs, then follow up here if things go well there. Thanks! |
This was implemented and merged in Would like to port this over into pandas-dev, but I think the minimum python version here is 3.9. And I don't think EDIT: My mistake, was on a old local version, I can see now |
Feature Type
Adding new functionality to pandas
Changing existing functionality in pandas
Removing existing functionality in pandas
Problem Description
Right now the
*args
and**kwargs
inpandas.DataFrame.pipe
are not typed, removing any type checking benefit on the parameters if a typed function is used viapipe
.pandas/pandas/core/generic.py
Lines 6039 to 6044 in 2a953cf
Feature Description
I'd be happy to contribute this if this seems acceptable.
I have a basic implementation here of what I'd want to apply to the real method. I'm guessing this would go in pandas-stubs as well?
One con here is that the tuple version of the
func
parameter does not useParamSpec
, sinceConcatenate
requires that the additional type comes first. So users using a tuple forfunc
wouldn't benefit from the type checking. Unfortunately, don't really know a way around this right now.Alternative Solutions
Not sure of an alternative solution here besides just implementing in pandas-stubs. Figured I might as well do both.
Additional Context
pipe
in pandas-stubs.The text was updated successfully, but these errors were encountered: