@@ -229,7 +229,7 @@ def group_cumprod_float64(float64_t[:, :] out,
229
229
@ cython.boundscheck (False )
230
230
@ cython.wraparound (False )
231
231
def group_cumsum (numeric[:, :] out ,
232
- numeric[:, : ] values ,
232
+ ndarray[ numeric , ndim = 2 ] values,
233
233
const int64_t[:] labels ,
234
234
int ngroups ,
235
235
is_datetimelike ,
@@ -472,7 +472,7 @@ ctypedef fused complexfloating_t:
472
472
@ cython.boundscheck (False )
473
473
def _group_add (complexfloating_t[:, :] out ,
474
474
int64_t[:] counts ,
475
- complexfloating_t[:, : ] values ,
475
+ ndarray[ complexfloating_t , ndim = 2 ] values,
476
476
const int64_t[:] labels ,
477
477
Py_ssize_t min_count = 0 ):
478
478
"""
@@ -483,8 +483,9 @@ def _group_add(complexfloating_t[:, :] out,
483
483
complexfloating_t val, count
484
484
complexfloating_t[:, :] sumx
485
485
int64_t[:, :] nobs
486
+ Py_ssize_t len_values = len (values), len_labels = len (labels)
486
487
487
- if len (values) != len (labels) :
488
+ if len_values != len_labels :
488
489
raise ValueError (" len(index) != len(labels)" )
489
490
490
491
nobs = np.zeros((< object > out).shape, dtype = np.int64)
@@ -530,7 +531,7 @@ group_add_complex128 = _group_add['double complex']
530
531
@ cython.boundscheck (False )
531
532
def _group_prod (floating[:, :] out ,
532
533
int64_t[:] counts ,
533
- floating[:, : ] values ,
534
+ ndarray[ floating , ndim = 2 ] values,
534
535
const int64_t[:] labels ,
535
536
Py_ssize_t min_count = 0 ):
536
537
"""
@@ -541,8 +542,9 @@ def _group_prod(floating[:, :] out,
541
542
floating val, count
542
543
floating[:, :] prodx
543
544
int64_t[:, :] nobs
545
+ Py_ssize_t len_values = len (values), len_labels = len (labels)
544
546
545
- if not len (values) == len (labels) :
547
+ if len_values ! = len_labels :
546
548
raise ValueError (" len(index) != len(labels)" )
547
549
548
550
nobs = np.zeros((< object > out).shape, dtype = np.int64)
@@ -582,7 +584,7 @@ group_prod_float64 = _group_prod['double']
582
584
@ cython.cdivision (True )
583
585
def _group_var (floating[:, :] out ,
584
586
int64_t[:] counts ,
585
- floating[:, : ] values ,
587
+ ndarray[ floating , ndim = 2 ] values,
586
588
const int64_t[:] labels ,
587
589
Py_ssize_t min_count = - 1 ,
588
590
int64_t ddof = 1 ):
@@ -591,10 +593,11 @@ def _group_var(floating[:, :] out,
591
593
floating val, ct, oldmean
592
594
floating[:, :] mean
593
595
int64_t[:, :] nobs
596
+ Py_ssize_t len_values = len (values), len_labels = len (labels)
594
597
595
598
assert min_count == - 1 , " 'min_count' only used in add and prod"
596
599
597
- if not len (values) == len (labels) :
600
+ if len_values ! = len_labels :
598
601
raise ValueError (" len(index) != len(labels)" )
599
602
600
603
nobs = np.zeros((< object > out).shape, dtype = np.int64)
@@ -639,18 +642,19 @@ group_var_float64 = _group_var['double']
639
642
@ cython.boundscheck (False )
640
643
def _group_mean (floating[:, :] out ,
641
644
int64_t[:] counts ,
642
- floating[:, : ] values ,
645
+ ndarray[ floating , ndim = 2 ] values,
643
646
const int64_t[:] labels ,
644
647
Py_ssize_t min_count = - 1 ):
645
648
cdef:
646
649
Py_ssize_t i, j, N, K, lab, ncounts = len (counts)
647
650
floating val, count
648
651
floating[:, :] sumx
649
652
int64_t[:, :] nobs
653
+ Py_ssize_t len_values = len (values), len_labels = len (labels)
650
654
651
655
assert min_count == - 1 , " 'min_count' only used in add and prod"
652
656
653
- if not len (values) == len (labels) :
657
+ if len_values ! = len_labels :
654
658
raise ValueError (" len(index) != len(labels)" )
655
659
656
660
nobs = np.zeros((< object > out).shape, dtype = np.int64)
@@ -689,7 +693,7 @@ group_mean_float64 = _group_mean['double']
689
693
@ cython.boundscheck (False )
690
694
def _group_ohlc (floating[:, :] out ,
691
695
int64_t[:] counts ,
692
- floating[:, : ] values ,
696
+ ndarray[ floating , ndim = 2 ] values,
693
697
const int64_t[:] labels ,
694
698
Py_ssize_t min_count = - 1 ):
695
699
"""
@@ -740,7 +744,7 @@ group_ohlc_float64 = _group_ohlc['double']
740
744
@ cython.boundscheck (False )
741
745
@ cython.wraparound (False )
742
746
def group_quantile (ndarray[float64_t] out ,
743
- numeric[: ] values ,
747
+ ndarray[ numeric , ndim = 1 ] values,
744
748
ndarray[int64_t] labels ,
745
749
ndarray[uint8_t] mask ,
746
750
float64_t q ,
@@ -1072,7 +1076,7 @@ def group_nth(rank_t[:, :] out,
1072
1076
@ cython.boundscheck (False )
1073
1077
@ cython.wraparound (False )
1074
1078
def group_rank (float64_t[:, :] out ,
1075
- rank_t[:, : ] values ,
1079
+ ndarray[ rank_t , ndim = 2 ] values,
1076
1080
const int64_t[:] labels ,
1077
1081
int ngroups ,
1078
1082
bint is_datetimelike , object ties_method = " average" ,
@@ -1424,7 +1428,7 @@ def group_min(groupby_t[:, :] out,
1424
1428
@ cython.boundscheck (False )
1425
1429
@ cython.wraparound (False )
1426
1430
def group_cummin (groupby_t[:, :] out ,
1427
- groupby_t[:, : ] values ,
1431
+ ndarray[ groupby_t , ndim = 2 ] values,
1428
1432
const int64_t[:] labels ,
1429
1433
int ngroups ,
1430
1434
bint is_datetimelike ):
@@ -1484,7 +1488,7 @@ def group_cummin(groupby_t[:, :] out,
1484
1488
@ cython.boundscheck (False )
1485
1489
@ cython.wraparound (False )
1486
1490
def group_cummax (groupby_t[:, :] out ,
1487
- groupby_t[:, : ] values ,
1491
+ ndarray[ groupby_t , ndim = 2 ] values,
1488
1492
const int64_t[:] labels ,
1489
1493
int ngroups ,
1490
1494
bint is_datetimelike ):
0 commit comments