You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using pipe returns a instance of the type pipe is called on, but the type stubs imply it's the type of the function being applied by pipe.
i.e. if my function returns a DataFrame, but I call pipe on a class which inherits from DataFrame, then at run time I get back the subclass, but the typing implies it's just a vanilla DataFrame.
Describe the bug
Using
pipe
returns a instance of the type pipe is called on, but the type stubs imply it's the type of the function being applied by pipe.i.e. if my function returns a
DataFrame
, but I callpipe
on a class which inherits fromDataFrame
, then at run time I get back the subclass, but the typing implies it's just a vanillaDataFrame
.To Reproduce
Subclass
DataFrame
per the docs.Create a
pipe
function using this signature:Observe that at run time if I use
pipe
on the subtype, your get back an instance of the subtype, which is nice:But if you hover
sub_f
in VSCode it's type isDataFrame
.Please complete the following information:
pandas-stubs
2.2.1.240316Additional context
The offending type is the
T
here, it it should returnSelf
:pandas-stubs/pandas-stubs/core/generic.pyi
Lines 369 to 374 in 072997b
The text was updated successfully, but these errors were encountered: