Skip to content

Commit b21c771

Browse files
committed
TYP: narrow SeriesApply func type
1 parent 66f08b9 commit b21c771

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

pandas/core/apply.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,7 @@ class SeriesApply(NDFrameApply):
10491049
def __init__(
10501050
self,
10511051
obj: Series,
1052-
func: AggFuncType,
1052+
func: AggFuncTypeBase | list[AggFuncTypeBase],
10531053
convert_dtype: bool,
10541054
args,
10551055
kwargs,

pandas/core/series.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
)
3333
from pandas._libs.lib import no_default
3434
from pandas._typing import (
35-
AggFuncType,
35+
AggFuncTypeBase,
3636
ArrayLike,
3737
Axis,
3838
Dtype,
@@ -4439,7 +4439,11 @@ def any(
44394439
axis=_shared_doc_kwargs["axis"],
44404440
)
44414441
def transform(
4442-
self, func: AggFuncType, axis: Axis = 0, *args, **kwargs
4442+
self,
4443+
func: AggFuncTypeBase | list[AggFuncTypeBase],
4444+
axis: Axis = 0,
4445+
*args,
4446+
**kwargs,
44434447
) -> DataFrame | Series:
44444448
# Validate axis argument
44454449
self._get_axis_number(axis)
@@ -4450,7 +4454,7 @@ def transform(
44504454

44514455
def apply(
44524456
self,
4453-
func: AggFuncType,
4457+
func: AggFuncTypeBase | list[AggFuncTypeBase],
44544458
convert_dtype: bool = True,
44554459
args: tuple[Any, ...] = (),
44564460
**kwargs,

0 commit comments

Comments
 (0)