Skip to content

Commit 5c57b9c

Browse files
jbrockmendelJulianWgs
authored andcommitted
TYP: groupby.pyi (pandas-dev#40716)
1 parent 4ebaf76 commit 5c57b9c

File tree

2 files changed

+174
-6
lines changed

2 files changed

+174
-6
lines changed

pandas/_libs/groupby.pyi

+168
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
from typing import Literal
2+
3+
import numpy as np
4+
5+
def group_median_float64(
6+
out: np.ndarray, # ndarray[float64_t, ndim=2]
7+
counts: np.ndarray, # ndarray[int64_t]
8+
values: np.ndarray, # ndarray[float64_t, ndim=2]
9+
labels: np.ndarray, # ndarray[int64_t]
10+
min_count: int = ..., # Py_ssize_t
11+
) -> None: ...
12+
13+
def group_cumprod_float64(
14+
out: np.ndarray, # float64_t[:, ::1]
15+
values: np.ndarray, # const float64_t[:, :]
16+
labels: np.ndarray, # const int64_t[:]
17+
ngroups: int,
18+
is_datetimelike: bool,
19+
skipna: bool = ...,
20+
) -> None: ...
21+
22+
def group_cumsum(
23+
out: np.ndarray, # numeric[:, ::1]
24+
values: np.ndarray, # ndarray[numeric, ndim=2]
25+
labels: np.ndarray, # const int64_t[:]
26+
ngroups: int,
27+
is_datetimelike: bool,
28+
skipna: bool = ...,
29+
) -> None: ...
30+
31+
32+
def group_shift_indexer(
33+
out: np.ndarray, # int64_t[::1]
34+
labels: np.ndarray, # const int64_t[:]
35+
ngroups: int,
36+
periods: int,
37+
) -> None: ...
38+
39+
40+
def group_fillna_indexer(
41+
out: np.ndarray, # ndarray[int64_t]
42+
labels: np.ndarray, # ndarray[int64_t]
43+
mask: np.ndarray, # ndarray[uint8_t]
44+
direction: Literal["ffill", "bfill"],
45+
limit: int, # int64_t
46+
dropna: bool,
47+
) -> None: ...
48+
49+
50+
def group_any_all(
51+
out: np.ndarray, # uint8_t[::1]
52+
values: np.ndarray, # const uint8_t[::1]
53+
labels: np.ndarray, # const int64_t[:]
54+
mask: np.ndarray, # const uint8_t[::1]
55+
val_test: Literal["any", "all"],
56+
skipna: bool,
57+
) -> None: ...
58+
59+
def group_add(
60+
out: np.ndarray, # complexfloating_t[:, ::1]
61+
counts: np.ndarray, # int64_t[::1]
62+
values: np.ndarray, # ndarray[complexfloating_t, ndim=2]
63+
labels: np.ndarray, # const intp_t[:]
64+
min_count: int = ...
65+
) -> None: ...
66+
67+
def group_prod(
68+
out: np.ndarray, # floating[:, ::1]
69+
counts: np.ndarray, # int64_t[::1]
70+
values: np.ndarray, # ndarray[floating, ndim=2]
71+
labels: np.ndarray, # const intp_t[:]
72+
min_count: int = ...
73+
) -> None: ...
74+
75+
def group_var(
76+
out: np.ndarray, # floating[:, ::1]
77+
counts: np.ndarray, # int64_t[::1]
78+
values: np.ndarray, # ndarray[floating, ndim=2]
79+
labels: np.ndarray, # const intp_t[:]
80+
min_count: int = ..., # Py_ssize_t
81+
ddof: int = ..., # int64_t
82+
) -> None: ...
83+
84+
def group_mean(
85+
out: np.ndarray, # floating[:, ::1]
86+
counts: np.ndarray, # int64_t[::1]
87+
values: np.ndarray, # ndarray[floating, ndim=2]
88+
labels: np.ndarray, # const intp_t[:]
89+
min_count: int = ...
90+
) -> None: ...
91+
92+
def group_ohlc(
93+
out: np.ndarray, # floating[:, ::1]
94+
counts: np.ndarray, # int64_t[::1]
95+
values: np.ndarray, # ndarray[floating, ndim=2]
96+
labels: np.ndarray, # const intp_t[:]
97+
min_count: int = ...
98+
) -> None: ...
99+
100+
def group_quantile(
101+
out: np.ndarray, # ndarray[float64_t]
102+
values: np.ndarray, # ndarray[numeric, ndim=1]
103+
labels: np.ndarray, # ndarray[int64_t]
104+
mask: np.ndarray, # ndarray[uint8_t]
105+
q: float, # float64_t
106+
interpolation: Literal["linear", "lower", "higher", "nearest", "midpoint"],
107+
) -> None: ...
108+
109+
def group_last(
110+
out: np.ndarray, # rank_t[:, ::1]
111+
counts: np.ndarray, # int64_t[::1]
112+
values: np.ndarray, # ndarray[rank_t, ndim=2]
113+
labels: np.ndarray, # const int64_t[:]
114+
min_count: int = ..., # Py_ssize_t
115+
) -> None: ...
116+
117+
def group_nth(
118+
out: np.ndarray, # rank_t[:, ::1]
119+
counts: np.ndarray, # int64_t[::1]
120+
values: np.ndarray, # ndarray[rank_t, ndim=2]
121+
labels: np.ndarray, # const int64_t[:]
122+
min_count: int = ..., # int64_t
123+
rank: int = ..., # int64_t
124+
) -> None: ...
125+
126+
def group_rank(
127+
out: np.ndarray, # float64_t[:, ::1]
128+
values: np.ndarray, # ndarray[rank_t, ndim=2]
129+
labels: np.ndarray, # const int64_t[:]
130+
ngroups: int,
131+
is_datetimelike: bool,
132+
ties_method: Literal["aveage", "min", "max", "first", "dense"] = ...,
133+
ascending: bool = ...,
134+
pct: bool = ...,
135+
na_option: Literal["keep", "top", "bottom"] = ...,
136+
) -> None: ...
137+
138+
def group_max(
139+
out: np.ndarray, # groupby_t[:, ::1]
140+
counts: np.ndarray, # int64_t[::1]
141+
values: np.ndarray, # ndarray[groupby_t, ndim=2]
142+
labels: np.ndarray, # const int64_t[:]
143+
min_count: int = ...,
144+
) -> None: ...
145+
146+
def group_min(
147+
out: np.ndarray, # groupby_t[:, ::1]
148+
counts: np.ndarray, # int64_t[::1]
149+
values: np.ndarray, # ndarray[groupby_t, ndim=2]
150+
labels: np.ndarray, # const int64_t[:]
151+
min_count: int = ...,
152+
) -> None: ...
153+
154+
def group_cummin(
155+
out: np.ndarray, # groupby_t[:, ::1]
156+
values: np.ndarray, # ndarray[groupby_t, ndim=2]
157+
labels: np.ndarray, # const int64_t[:]
158+
ngroups: int,
159+
is_datetimelike: bool,
160+
) -> None: ...
161+
162+
def group_cummax(
163+
out: np.ndarray, # groupby_t[:, ::1]
164+
values: np.ndarray, # ndarray[groupby_t, ndim=2]
165+
labels: np.ndarray, # const int64_t[:]
166+
ngroups: int,
167+
is_datetimelike: bool,
168+
) -> None: ...

pandas/_libs/groupby.pyx

+6-6
Original file line numberDiff line numberDiff line change
@@ -1239,12 +1239,12 @@ def group_min(groupby_t[:, ::1] out,
12391239

12401240
@cython.boundscheck(False)
12411241
@cython.wraparound(False)
1242-
def group_cummin_max(groupby_t[:, ::1] out,
1243-
ndarray[groupby_t, ndim=2] values,
1244-
const intp_t[:] labels,
1245-
int ngroups,
1246-
bint is_datetimelike,
1247-
bint compute_max):
1242+
cdef group_cummin_max(groupby_t[:, ::1] out,
1243+
ndarray[groupby_t, ndim=2] values,
1244+
const intp_t[:] labels,
1245+
int ngroups,
1246+
bint is_datetimelike,
1247+
bint compute_max):
12481248
"""
12491249
Cumulative minimum/maximum of columns of `values`, in row groups `labels`.
12501250

0 commit comments

Comments
 (0)