@@ -402,9 +402,9 @@ def group_any_all(uint8_t[::1] out,
402
402
ordering matching up to the corresponding record in `values`
403
403
values : array containing the truth value of each element
404
404
mask : array indicating whether a value is na or not
405
- val_test : str {'any', 'all'}
405
+ val_test : {'any', 'all'}
406
406
String object dictating whether to use any or all truth testing
407
- skipna : boolean
407
+ skipna : bool
408
408
Flag to ignore nan values during truth testing
409
409
410
410
Notes
@@ -455,11 +455,11 @@ ctypedef fused complexfloating_t:
455
455
456
456
@ cython.wraparound (False )
457
457
@ cython.boundscheck (False )
458
- def _group_add (complexfloating_t[:, ::1] out ,
459
- int64_t[::1] counts ,
460
- ndarray[complexfloating_t , ndim = 2 ] values,
461
- const intp_t[:] labels ,
462
- Py_ssize_t min_count = 0 ):
458
+ def group_add (complexfloating_t[:, ::1] out ,
459
+ int64_t[::1] counts ,
460
+ ndarray[complexfloating_t , ndim = 2 ] values,
461
+ const intp_t[:] labels ,
462
+ Py_ssize_t min_count = 0 ):
463
463
"""
464
464
Only aggregates on axis=0 using Kahan summation
465
465
"""
@@ -506,19 +506,13 @@ def _group_add(complexfloating_t[:, ::1] out,
506
506
out[i, j] = sumx[i, j]
507
507
508
508
509
- group_add_float32 = _group_add[' float32_t' ]
510
- group_add_float64 = _group_add[' float64_t' ]
511
- group_add_complex64 = _group_add[' float complex' ]
512
- group_add_complex128 = _group_add[' double complex' ]
513
-
514
-
515
509
@ cython.wraparound (False )
516
510
@ cython.boundscheck (False )
517
- def _group_prod (floating[:, ::1] out ,
518
- int64_t[::1] counts ,
519
- ndarray[floating , ndim = 2 ] values,
520
- const intp_t[:] labels ,
521
- Py_ssize_t min_count = 0 ):
511
+ def group_prod (floating[:, ::1] out ,
512
+ int64_t[::1] counts ,
513
+ ndarray[floating , ndim = 2 ] values,
514
+ const intp_t[:] labels ,
515
+ Py_ssize_t min_count = 0 ):
522
516
"""
523
517
Only aggregates on axis=0
524
518
"""
@@ -560,19 +554,15 @@ def _group_prod(floating[:, ::1] out,
560
554
out[i, j] = prodx[i, j]
561
555
562
556
563
- group_prod_float32 = _group_prod[' float' ]
564
- group_prod_float64 = _group_prod[' double' ]
565
-
566
-
567
557
@ cython.wraparound (False )
568
558
@ cython.boundscheck (False )
569
559
@ cython.cdivision (True )
570
- def _group_var (floating[:, ::1] out ,
571
- int64_t[::1] counts ,
572
- ndarray[floating , ndim = 2 ] values,
573
- const intp_t[:] labels ,
574
- Py_ssize_t min_count = - 1 ,
575
- int64_t ddof = 1 ):
560
+ def group_var (floating[:, ::1] out ,
561
+ int64_t[::1] counts ,
562
+ ndarray[floating , ndim = 2 ] values,
563
+ const intp_t[:] labels ,
564
+ Py_ssize_t min_count = - 1 ,
565
+ int64_t ddof = 1 ):
576
566
cdef:
577
567
Py_ssize_t i, j, N, K, lab, ncounts = len (counts)
578
568
floating val, ct, oldmean
@@ -619,17 +609,13 @@ def _group_var(floating[:, ::1] out,
619
609
out[i, j] /= (ct - ddof)
620
610
621
611
622
- group_var_float32 = _group_var[' float' ]
623
- group_var_float64 = _group_var[' double' ]
624
-
625
-
626
612
@ cython.wraparound (False )
627
613
@ cython.boundscheck (False )
628
- def _group_mean (floating[:, ::1] out ,
629
- int64_t[::1] counts ,
630
- ndarray[floating , ndim = 2 ] values,
631
- const intp_t[::1] labels ,
632
- Py_ssize_t min_count = - 1 ):
614
+ def group_mean (floating[:, ::1] out ,
615
+ int64_t[::1] counts ,
616
+ ndarray[floating , ndim = 2 ] values,
617
+ const intp_t[::1] labels ,
618
+ Py_ssize_t min_count = - 1 ):
633
619
cdef:
634
620
Py_ssize_t i, j, N, K, lab, ncounts = len (counts)
635
621
floating val, count, y, t
@@ -675,10 +661,6 @@ def _group_mean(floating[:, ::1] out,
675
661
out[i, j] = sumx[i, j] / count
676
662
677
663
678
- group_mean_float32 = _group_mean[' float' ]
679
- group_mean_float64 = _group_mean[' double' ]
680
-
681
-
682
664
@ cython.wraparound (False )
683
665
@ cython.boundscheck (False )
684
666
def group_ohlc (floating[:, ::1] out ,
@@ -1083,10 +1065,10 @@ def group_rank(float64_t[:, ::1] out,
1083
1065
* max: highest rank in group
1084
1066
* first: ranks assigned in order they appear in the array
1085
1067
* dense: like 'min', but rank always increases by 1 between groups
1086
- ascending : boolean , default True
1068
+ ascending : bool , default True
1087
1069
False for ranks by high (1) to low (N)
1088
1070
na_option : {'keep', 'top', 'bottom'}, default 'keep'
1089
- pct : boolean , default False
1071
+ pct : bool , default False
1090
1072
Compute percentage rank of data within each group
1091
1073
na_option : {'keep', 'top', 'bottom'}, default 'keep'
1092
1074
* keep: leave NA values where they are
0 commit comments