Skip to content

Commit 4141a06

Browse files
GH456 PR Feedback
1 parent 053b7e7 commit 4141a06

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

pandas-stubs/core/groupby/generic.pyi

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@ class SeriesGroupBy(GroupBy[Series[S1]], Generic[S1, ByT]):
7171
**kwargs,
7272
) -> Series[S2]: ...
7373
@overload
74+
def aggregate(
75+
self,
76+
func: Callable[[Series], S2],
77+
*args,
78+
engine: WindowingEngine = ...,
79+
engine_kwargs: WindowingEngineKwargs = ...,
80+
**kwargs,
81+
) -> Series[S2]: ...
82+
@overload
7483
def aggregate(
7584
self,
7685
func: list[AggFuncTypeBase],

tests/test_series.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,6 +1119,20 @@ def transform_func(
11191119
pd.Series,
11201120
float,
11211121
)
1122+
check(
1123+
assert_type(
1124+
s.groupby(lambda x: x).transform("mean"),
1125+
"pd.Series",
1126+
),
1127+
pd.Series,
1128+
)
1129+
check(
1130+
assert_type(
1131+
s.groupby(lambda x: x).transform("first"),
1132+
"pd.Series",
1133+
),
1134+
pd.Series,
1135+
)
11221136

11231137

11241138
def test_types_groupby_aggregate() -> None:

0 commit comments

Comments
 (0)