|
1 |
| -from typing import overload, List, Iterator |
| 1 | +from typing import overload, Optional, Union, List, Dict, Iterator |
| 2 | +import numpy as _np |
2 | 3 |
|
3 | 4 | from pandas.core.frame import DataFrame
|
4 | 5 | from pandas.core.series import Series
|
| 6 | +from ..frame import _FunctionLike |
| 7 | + |
| 8 | +_str = str # needed because Series has a property called "str"... |
5 | 9 |
|
6 | 10 | class GroupBy: ...
|
7 | 11 |
|
8 | 12 | class DataFrameGroupBy(GroupBy):
|
9 | 13 | @overload
|
10 |
| - def __getitem__(self, item: str) -> Series: ... |
| 14 | + def __getitem__(self, item: _str) -> SeriesGroupBy: ... |
11 | 15 | @overload
|
12 |
| - def __getitem__(self, item: List[str]) -> DataFrame: ... |
| 16 | + def __getitem__(self, item: List[_str]) -> DataFrameGroupBy: ... |
| 17 | + def __getattr__(self, name: _str) -> SeriesGroupBy: ... |
13 | 18 | def __iter__(self) -> Iterator: ...
|
| 19 | + def aggregate( |
| 20 | + self, func: Union[_FunctionLike, List[_FunctionLike], Dict[_str, _FunctionLike]], |
| 21 | + ) -> DataFrame: ... |
| 22 | + agg = aggregate |
| 23 | + def count(self) -> DataFrame: ... |
| 24 | + def head(self, n: int = ...) -> DataFrame: ... |
| 25 | + def max(self) -> DataFrame: ... |
| 26 | + def mean(self) -> DataFrame: ... |
| 27 | + def median(self) -> DataFrame: ... |
| 28 | + def min(self) -> DataFrame: ... |
| 29 | + def nunique(self, dropna: bool = ...) -> DataFrame: ... |
| 30 | + def quantile(self, q: float = ..., interpolation: str = ...) -> DataFrame: ... |
| 31 | + def std(self, ddof: int = ...) -> DataFrame: ... |
| 32 | + def sum(self) -> DataFrame: ... |
| 33 | + def tail(self, n: int = ...) -> DataFrame: ... |
| 34 | + def var(self, ddof: int = ...) -> DataFrame: ... |
14 | 35 |
|
15 | 36 | class SeriesGroupBy(GroupBy):
|
16 |
| - def __getitem__(self, item: str) -> Series: ... |
| 37 | + def __getitem__(self, item: _str) -> Series: ... |
| 38 | + def count(self) -> Series: ... |
| 39 | + def head(self, n: int = ...) -> Series: ... |
17 | 40 | def max(self) -> Series: ...
|
18 | 41 | def mean(self) -> Series: ...
|
19 | 42 | def median(self) -> Series: ...
|
20 | 43 | def min(self) -> Series: ...
|
| 44 | + def nunique(self, dropna: bool = ...) -> Series: ... |
| 45 | + def quantile(self, q: float = ..., interpolation: str = ...) -> Series: ... |
21 | 46 | def std(self, ddof: int = ...) -> Series: ...
|
| 47 | + def sum(self) -> Series: ... |
| 48 | + def tail(self, n: int = ...) -> Series: ... |
| 49 | + def unique(self) -> Series[_np.ndarray]: ... |
| 50 | + def var(self, ddof: int = ...) -> Series: ... |
0 commit comments