@@ -29,6 +29,7 @@ class providing the base-class of operations.
29
29
Union ,
30
30
cast ,
31
31
final ,
32
+ overload ,
32
33
)
33
34
import warnings
34
35
@@ -55,7 +56,6 @@ class providing the base-class of operations.
55
56
PositionalIndexer ,
56
57
RandomState ,
57
58
Scalar ,
58
- T ,
59
59
npt ,
60
60
)
61
61
from pandas .compat .numpy import function as nv
@@ -147,7 +147,13 @@ class providing the base-class of operations.
147
147
)
148
148
149
149
if TYPE_CHECKING :
150
- from typing import Any
150
+ from pandas ._typing import (
151
+ Any ,
152
+ Concatenate ,
153
+ P ,
154
+ Self ,
155
+ T ,
156
+ )
151
157
152
158
from pandas .core .resample import Resampler
153
159
from pandas .core .window import (
@@ -988,6 +994,24 @@ def _selected_obj(self):
988
994
def _dir_additions (self ) -> set [str ]:
989
995
return self .obj ._dir_additions ()
990
996
997
+ @overload
998
+ def pipe (
999
+ self ,
1000
+ func : Callable [Concatenate [Self , P ], T ],
1001
+ * args : P .args ,
1002
+ ** kwargs : P .kwargs ,
1003
+ ) -> T :
1004
+ ...
1005
+
1006
+ @overload
1007
+ def pipe (
1008
+ self ,
1009
+ func : tuple [Callable [..., T ], str ],
1010
+ * args : Any ,
1011
+ ** kwargs : Any ,
1012
+ ) -> T :
1013
+ ...
1014
+
991
1015
@Substitution (
992
1016
klass = "GroupBy" ,
993
1017
examples = dedent (
@@ -1013,9 +1037,9 @@ def _dir_additions(self) -> set[str]:
1013
1037
@Appender (_pipe_template )
1014
1038
def pipe (
1015
1039
self ,
1016
- func : Callable [... , T ] | tuple [Callable [..., T ], str ],
1017
- * args ,
1018
- ** kwargs ,
1040
+ func : Callable [Concatenate [ Self , P ] , T ] | tuple [Callable [..., T ], str ],
1041
+ * args : Any ,
1042
+ ** kwargs : Any ,
1019
1043
) -> T :
1020
1044
return com .pipe (self , func , * args , ** kwargs )
1021
1045
0 commit comments