|
1 | 1 | from collections.abc import ( |
2 | | - Callable, |
3 | | - Hashable, |
4 | 2 | Iterator, |
5 | 3 | ) |
6 | 4 | from typing import ( |
7 | 5 | Generic, |
8 | | - final, |
9 | 6 | ) |
10 | 7 |
|
11 | 8 | import numpy as np |
12 | | -from pandas import ( |
13 | | - Index, |
14 | | - Series, |
15 | | -) |
16 | | -from pandas.core.groupby import grouper |
17 | 9 |
|
18 | 10 | from pandas._typing import ( |
19 | | - ArrayLike, |
20 | 11 | AxisInt, |
21 | | - Incomplete, |
22 | 12 | NDFrameT, |
23 | | - Shape, |
24 | | - T, |
25 | 13 | npt, |
26 | 14 | ) |
27 | | -from pandas.util._decorators import cache_readonly |
28 | | - |
29 | | -class BaseGrouper: |
30 | | - axis: Index |
31 | | - dropna: bool |
32 | | - @property |
33 | | - def groupings(self) -> list[grouper.Grouping]: ... |
34 | | - @property |
35 | | - def shape(self) -> Shape: ... |
36 | | - def __iter__(self) -> Iterator: ... |
37 | | - @property |
38 | | - def nkeys(self) -> int: ... |
39 | | - def get_iterator( |
40 | | - self, data: NDFrameT, axis: AxisInt = ... |
41 | | - ) -> Iterator[tuple[Hashable, NDFrameT]]: ... |
42 | | - @cache_readonly |
43 | | - def indices(self) -> dict[Hashable, npt.NDArray[np.intp]]: ... |
44 | | - @final |
45 | | - def result_ilocs(self) -> npt.NDArray[np.intp]: ... |
46 | | - @final |
47 | | - @property |
48 | | - def codes(self) -> list[npt.NDArray[np.signedinteger]]: ... |
49 | | - @property |
50 | | - def levels(self) -> list[Index]: ... |
51 | | - @property |
52 | | - def names(self) -> list: ... |
53 | | - @final |
54 | | - def size(self) -> Series: ... |
55 | | - @cache_readonly |
56 | | - def groups(self) -> dict[Hashable, Index]: ... |
57 | | - @final |
58 | | - @cache_readonly |
59 | | - def is_monotonic(self) -> bool: ... |
60 | | - @final |
61 | | - @cache_readonly |
62 | | - def has_dropped_na(self) -> bool: ... |
63 | | - @cache_readonly |
64 | | - def group_info(self) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp], int]: ... |
65 | | - @cache_readonly |
66 | | - def codes_info(self) -> npt.NDArray[np.intp]: ... |
67 | | - @final |
68 | | - @cache_readonly |
69 | | - def ngroups(self) -> int: ... |
70 | | - @property |
71 | | - def reconstructed_codes(self) -> list[npt.NDArray[np.intp]]: ... |
72 | | - @cache_readonly |
73 | | - def result_index(self) -> Index: ... |
74 | | - @final |
75 | | - def get_group_levels(self) -> list[ArrayLike]: ... |
76 | | - @final |
77 | | - def agg_series( |
78 | | - self, |
79 | | - obj: Series, |
80 | | - func: Callable[[Series], object], |
81 | | - preserve_dtype: bool = ..., |
82 | | - ) -> ArrayLike: ... |
83 | | - @final |
84 | | - def apply_groupwise( |
85 | | - self, f: Callable[[NDFrameT], T], data: NDFrameT, axis: AxisInt = ... |
86 | | - ) -> tuple[list[T], bool]: ... |
87 | | - |
88 | | -class BinGrouper(BaseGrouper): |
89 | | - bins: npt.NDArray[np.int64] |
90 | | - binlabels: Index |
91 | | - indexer: npt.NDArray[np.intp] |
92 | | - @cache_readonly |
93 | | - def indices(self) -> dict[Incomplete, list[int]]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] |
94 | 15 |
|
95 | 16 | class DataSplitter(Generic[NDFrameT]): |
96 | 17 | data: NDFrameT |
|
0 commit comments