Skip to content

Commit 927d438

Browse files
authored
CLEAN: Align Groupby types (#166)
1 parent 32db176 commit 927d438

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

pandas-stubs/core/base.pyi

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
from __future__ import annotations
22

33
from typing import (
4-
Callable,
54
Generic,
65
Literal,
76
)
87

98
import numpy as np
10-
from pandas import (
11-
DataFrame,
12-
Index,
13-
Series,
14-
)
9+
from pandas import Index
1510
from pandas.core.accessor import DirNamesMixin
1611
from pandas.core.arrays import ExtensionArray
1712
from pandas.core.arrays.categorical import Categorical
1813

1914
from pandas._typing import (
2015
NDFrameT,
21-
Scalar,
2216
SeriesAxisType,
2317
)
2418

@@ -35,10 +29,6 @@ class SpecificationError(GroupByError): ...
3529
class SelectionMixin(Generic[NDFrameT]):
3630
def ndim(self) -> int: ...
3731
def __getitem__(self, key): ...
38-
def aggregate(
39-
self, func: Callable | None = ..., *args, **kwargs
40-
) -> Scalar | Series | DataFrame: ...
41-
agg = aggregate
4232

4333
class ShallowMixin: ...
4434

pandas-stubs/core/groupby/groupby.pyi

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ from __future__ import annotations
22

33
from typing import Callable
44

5-
from pandas.core.base import PandasObject
5+
from pandas.core.base import (
6+
PandasObject,
7+
SelectionMixin,
8+
)
69
from pandas.core.frame import DataFrame
710
from pandas.core.generic import NDFrame
811
from pandas.core.groupby import ops
@@ -14,14 +17,15 @@ from pandas._typing import (
1417
AxisType,
1518
FrameOrSeriesUnion,
1619
KeysArgType,
20+
NDFrameT,
1721
)
1822

1923
class GroupByPlot(PandasObject):
2024
def __init__(self, groupby) -> None: ...
2125
def __call__(self, *args, **kwargs): ...
2226
def __getattr__(self, name: str): ...
2327

24-
class _GroupBy(PandasObject, GroupByIndexingMixin):
28+
class BaseGroupBy(PandasObject, SelectionMixin[NDFrameT], GroupByIndexingMixin):
2529
level = ...
2630
as_index = ...
2731
keys = ...
@@ -63,7 +67,7 @@ class _GroupBy(PandasObject, GroupByIndexingMixin):
6367
def get_group(self, name, obj: DataFrame | None = ...) -> DataFrame: ...
6468
def apply(self, func: Callable, *args, **kwargs) -> FrameOrSeriesUnion: ...
6569

66-
class GroupBy(_GroupBy):
70+
class GroupBy(BaseGroupBy[NDFrameT]):
6771
def count(self) -> FrameOrSeriesUnion: ...
6872
def mean(self, **kwargs) -> FrameOrSeriesUnion: ...
6973
def median(self, **kwargs) -> FrameOrSeriesUnion: ...

pandas-stubs/core/resample.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ from __future__ import annotations
22

33
from pandas.core.base import ShallowMixin as ShallowMixin
44
from pandas.core.groupby.base import GroupByMixin as GroupByMixin
5-
from pandas.core.groupby.groupby import _GroupBy
5+
from pandas.core.groupby.groupby import BaseGroupBy
66
from pandas.core.groupby.grouper import Grouper as Grouper
77

88
from pandas._typing import FrameOrSeriesUnion
99

10-
class Resampler(_GroupBy, ShallowMixin):
10+
class Resampler(BaseGroupBy, ShallowMixin):
1111
def __init__(
1212
self, obj, groupby=..., axis: int = ..., kind=..., **kwargs
1313
) -> None: ...

0 commit comments

Comments
 (0)