@@ -29,10 +29,10 @@ def get_dispatch(dtypes):
29
29
30
30
@cython.wraparound(False)
31
31
@cython.boundscheck(False)
32
- def group_add_{{name}}(ndarray[ {{c_type}}, ndim=2 ] out,
33
- ndarray[ int64_t] counts,
34
- ndarray[ {{c_type}}, ndim=2 ] values,
35
- ndarray[ int64_t] labels,
32
+ def group_add_{{name}}({{c_type}}[:, : ] out,
33
+ int64_t[: ] counts,
34
+ {{c_type}}[:, : ] values,
35
+ const int64_t[: ] labels,
36
36
Py_ssize_t min_count=0):
37
37
"""
38
38
Only aggregates on axis=0
@@ -76,10 +76,10 @@ def group_add_{{name}}(ndarray[{{c_type}}, ndim=2] out,
76
76
77
77
@cython.wraparound(False)
78
78
@cython.boundscheck(False)
79
- def group_prod_{{name}}(ndarray[ {{c_type}}, ndim=2 ] out,
80
- ndarray[ int64_t] counts,
81
- ndarray[ {{c_type}}, ndim=2 ] values,
82
- ndarray[ int64_t] labels,
79
+ def group_prod_{{name}}({{c_type}}[:, : ] out,
80
+ int64_t[: ] counts,
81
+ {{c_type}}[:, : ] values,
82
+ const int64_t[: ] labels,
83
83
Py_ssize_t min_count=0):
84
84
"""
85
85
Only aggregates on axis=0
@@ -123,10 +123,10 @@ def group_prod_{{name}}(ndarray[{{c_type}}, ndim=2] out,
123
123
@cython.wraparound(False)
124
124
@cython.boundscheck(False)
125
125
@cython.cdivision(True)
126
- def group_var_{{name}}(ndarray[ {{c_type}}, ndim=2 ] out,
127
- ndarray[ int64_t] counts,
128
- ndarray[ {{c_type}}, ndim=2 ] values,
129
- ndarray[ int64_t] labels,
126
+ def group_var_{{name}}({{c_type}}[:, : ] out,
127
+ int64_t[: ] counts,
128
+ {{c_type}}[:, : ] values,
129
+ const int64_t[: ] labels,
130
130
Py_ssize_t min_count=-1):
131
131
cdef:
132
132
Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
@@ -175,10 +175,10 @@ def group_var_{{name}}(ndarray[{{c_type}}, ndim=2] out,
175
175
176
176
@cython.wraparound(False)
177
177
@cython.boundscheck(False)
178
- def group_mean_{{name}}(ndarray[ {{c_type}}, ndim=2 ] out,
179
- ndarray[ int64_t] counts,
180
- ndarray[ {{c_type}}, ndim=2 ] values,
181
- ndarray[ int64_t] labels,
178
+ def group_mean_{{name}}({{c_type}}[:, : ] out,
179
+ int64_t[: ] counts,
180
+ {{c_type}}[:, : ] values,
181
+ const int64_t[: ] labels,
182
182
Py_ssize_t min_count=-1):
183
183
cdef:
184
184
Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
@@ -220,11 +220,11 @@ def group_mean_{{name}}(ndarray[{{c_type}}, ndim=2] out,
220
220
221
221
@cython.wraparound(False)
222
222
@cython.boundscheck(False)
223
- def group_ohlc_{{name}}(ndarray[ {{c_type}}, ndim=2 ] out,
224
- ndarray[ int64_t] counts,
225
- ndarray[ {{c_type}}, ndim=2 ] values,
226
- ndarray[ int64_t] labels,
227
- Py_ssize_t min_count=-1):
223
+ def group_ohlc_{{name}}({{c_type}}[:, : ] out,
224
+ int64_t[: ] counts,
225
+ {{c_type}}[:, : ] values,
226
+ const int64_t[: ] labels,
227
+ Py_ssize_t min_count=-1):
228
228
"""
229
229
Only aggregates on axis=0
230
230
"""
@@ -293,10 +293,10 @@ def get_dispatch(dtypes):
293
293
294
294
@cython.wraparound(False)
295
295
@cython.boundscheck(False)
296
- def group_last_{{name}}(ndarray[ {{c_type}}, ndim=2 ] out,
297
- ndarray[ int64_t] counts,
298
- ndarray[ {{c_type}}, ndim=2 ] values,
299
- ndarray[ int64_t] labels,
296
+ def group_last_{{name}}({{c_type}}[:, : ] out,
297
+ int64_t[: ] counts,
298
+ {{c_type}}[:, : ] values,
299
+ const int64_t[: ] labels,
300
300
Py_ssize_t min_count=-1):
301
301
"""
302
302
Only aggregates on axis=0
@@ -350,10 +350,10 @@ def group_last_{{name}}(ndarray[{{c_type}}, ndim=2] out,
350
350
351
351
@cython.wraparound(False)
352
352
@cython.boundscheck(False)
353
- def group_nth_{{name}}(ndarray[ {{c_type}}, ndim=2 ] out,
354
- ndarray[ int64_t] counts,
355
- ndarray[ {{c_type}}, ndim=2 ] values,
356
- ndarray[ int64_t] labels, int64_t rank,
353
+ def group_nth_{{name}}({{c_type}}[:, : ] out,
354
+ int64_t[: ] counts,
355
+ {{c_type}}[:, : ] values,
356
+ const int64_t[: ] labels, int64_t rank,
357
357
Py_ssize_t min_count=-1):
358
358
"""
359
359
Only aggregates on axis=0
@@ -411,9 +411,9 @@ def group_nth_{{name}}(ndarray[{{c_type}}, ndim=2] out,
411
411
412
412
@cython.boundscheck(False)
413
413
@cython.wraparound(False)
414
- def group_rank_{{name}}(ndarray[ float64_t, ndim=2 ] out,
415
- ndarray[ {{c_type}}, ndim=2 ] values,
416
- ndarray[ int64_t] labels,
414
+ def group_rank_{{name}}(float64_t[:, : ] out,
415
+ {{c_type}}[:, : ] values,
416
+ const int64_t[: ] labels,
417
417
bint is_datetimelike, object ties_method,
418
418
bint ascending, bint pct, object na_option):
419
419
"""
@@ -606,10 +606,10 @@ ctypedef fused groupby_t:
606
606
607
607
@cython.wraparound(False)
608
608
@cython.boundscheck(False)
609
- def group_max(ndarray[ groupby_t, ndim=2 ] out,
610
- ndarray[ int64_t] counts,
611
- ndarray[ groupby_t, ndim=2 ] values,
612
- ndarray[ int64_t] labels,
609
+ def group_max(groupby_t[:, : ] out,
610
+ int64_t[: ] counts,
611
+ groupby_t[:, : ] values,
612
+ const int64_t[: ] labels,
613
613
Py_ssize_t min_count=-1):
614
614
"""
615
615
Only aggregates on axis=0
@@ -669,10 +669,10 @@ def group_max(ndarray[groupby_t, ndim=2] out,
669
669
670
670
@cython.wraparound(False)
671
671
@cython.boundscheck(False)
672
- def group_min(ndarray[ groupby_t, ndim=2 ] out,
673
- ndarray[ int64_t] counts,
674
- ndarray[ groupby_t, ndim=2 ] values,
675
- ndarray[ int64_t] labels,
672
+ def group_min(groupby_t[:, : ] out,
673
+ int64_t[: ] counts,
674
+ groupby_t[:, : ] values,
675
+ const int64_t[: ] labels,
676
676
Py_ssize_t min_count=-1):
677
677
"""
678
678
Only aggregates on axis=0
@@ -731,9 +731,9 @@ def group_min(ndarray[groupby_t, ndim=2] out,
731
731
732
732
@cython.boundscheck(False)
733
733
@cython.wraparound(False)
734
- def group_cummin(ndarray[ groupby_t, ndim=2 ] out,
735
- ndarray[ groupby_t, ndim=2 ] values,
736
- ndarray[ int64_t] labels,
734
+ def group_cummin(groupby_t[:, : ] out,
735
+ groupby_t[:, : ] values,
736
+ const int64_t[: ] labels,
737
737
bint is_datetimelike):
738
738
"""
739
739
Only transforms on axis=0
@@ -779,9 +779,9 @@ def group_cummin(ndarray[groupby_t, ndim=2] out,
779
779
780
780
@cython.boundscheck(False)
781
781
@cython.wraparound(False)
782
- def group_cummax(ndarray[ groupby_t, ndim=2 ] out,
783
- ndarray[ groupby_t, ndim=2 ] values,
784
- ndarray[ int64_t] labels,
782
+ def group_cummax(groupby_t[:, : ] out,
783
+ groupby_t[:, : ] values,
784
+ const int64_t[: ] labels,
785
785
bint is_datetimelike):
786
786
"""
787
787
Only transforms on axis=0
0 commit comments