Skip to content

Commit f7744ae

Browse files
committed
Type resample pipe with function params
1 parent 408214d commit f7744ae

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

pandas/core/resample.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
cast,
1010
final,
1111
no_type_check,
12+
overload,
1213
)
1314
import warnings
1415

@@ -97,12 +98,16 @@
9798
from collections.abc import Hashable
9899

99100
from pandas._typing import (
101+
Any,
100102
AnyArrayLike,
101103
Axis,
102104
AxisInt,
105+
Concatenate,
103106
Frequency,
104107
IndexLabel,
105108
InterpolateOptions,
109+
P,
110+
Self,
106111
T,
107112
TimedeltaConvertibleTypes,
108113
TimeGrouperOrigin,
@@ -254,6 +259,24 @@ def _get_binner(self):
254259
bin_grouper = BinGrouper(bins, binlabels, indexer=self._indexer)
255260
return binner, bin_grouper
256261

262+
@overload
263+
def pipe(
264+
self,
265+
func: Callable[Concatenate[Self, P], T],
266+
*args: P.args,
267+
**kwargs: P.kwargs,
268+
) -> T:
269+
...
270+
271+
@overload
272+
def pipe(
273+
self,
274+
func: tuple[Callable[..., T], str],
275+
*args: Any,
276+
**kwargs: Any,
277+
) -> T:
278+
...
279+
257280
@final
258281
@Substitution(
259282
klass="Resampler",
@@ -278,9 +301,9 @@ def _get_binner(self):
278301
@Appender(_pipe_template)
279302
def pipe(
280303
self,
281-
func: Callable[..., T] | tuple[Callable[..., T], str],
282-
*args,
283-
**kwargs,
304+
func: Callable[Concatenate[Self, P], T] | tuple[Callable[..., T], str],
305+
*args: Any,
306+
**kwargs: Any,
284307
) -> T:
285308
return super().pipe(func, *args, **kwargs)
286309

0 commit comments

Comments
 (0)