@@ -50,18 +50,17 @@ from pandas._libs.khash cimport (
50
50
51
51
import pandas._libs.missing as missing
52
52
53
- cdef float64_t FP_ERR = 1e-13
54
-
55
- cdef float64_t NaN = < float64_t> np.NaN
56
-
57
- cdef int64_t NPY_NAT = get_nat()
53
+ cdef:
54
+ float64_t FP_ERR = 1e-13
55
+ float64_t NaN = < float64_t> np.NaN
56
+ int64_t NPY_NAT = get_nat()
58
57
59
58
tiebreakers = {
60
- ' average' : TIEBREAK_AVERAGE,
61
- ' min' : TIEBREAK_MIN,
62
- ' max' : TIEBREAK_MAX,
63
- ' first' : TIEBREAK_FIRST,
64
- ' dense' : TIEBREAK_DENSE,
59
+ " average" : TIEBREAK_AVERAGE,
60
+ " min" : TIEBREAK_MIN,
61
+ " max" : TIEBREAK_MAX,
62
+ " first" : TIEBREAK_FIRST,
63
+ " dense" : TIEBREAK_DENSE,
65
64
}
66
65
67
66
@@ -120,6 +119,7 @@ cpdef ndarray[int64_t, ndim=1] unique_deltas(const int64_t[:] arr):
120
119
kh_int64_t * table
121
120
int ret = 0
122
121
list uniques = []
122
+ ndarray[int64_t, ndim= 1 ] result
123
123
124
124
table = kh_init_int64()
125
125
kh_resize_int64(table, 10 )
@@ -261,7 +261,7 @@ def kth_smallest(numeric[:] a, Py_ssize_t k) -> numeric:
261
261
262
262
@cython.boundscheck(False )
263
263
@cython.wraparound(False )
264
- def nancorr(const float64_t[:, :] mat , bint cov = 0 , minp = None ):
264
+ def nancorr(const float64_t[:, :] mat , bint cov = False , minp = None ):
265
265
cdef:
266
266
Py_ssize_t i, j, xi, yi, N, K
267
267
bint minpv
@@ -325,7 +325,7 @@ def nancorr(const float64_t[:, :] mat, bint cov=0, minp=None):
325
325
326
326
@ cython.boundscheck (False )
327
327
@ cython.wraparound (False )
328
- def nancorr_spearman (const float64_t[:, :] mat , Py_ssize_t minp = 1 ):
328
+ def nancorr_spearman (const float64_t[:, :] mat , Py_ssize_t minp = 1 ) -> ndarray :
329
329
cdef:
330
330
Py_ssize_t i , j , xi , yi , N , K
331
331
ndarray[float64_t , ndim = 2 ] result
581
581
582
582
@ cython.boundscheck (False )
583
583
@ cython.wraparound (False )
584
- def backfill (ndarray[algos_t] old , ndarray[algos_t] new , limit = None ):
584
+ def backfill (ndarray[algos_t] old , ndarray[algos_t] new , limit = None ) -> ndarray :
585
585
cdef:
586
586
Py_ssize_t i , j , nleft , nright
587
587
ndarray[int64_t , ndim = 1 ] indexer
@@ -810,18 +810,14 @@ def rank_1d(
810
810
"""
811
811
cdef:
812
812
Py_ssize_t i, j, n, dups = 0 , total_tie_count = 0 , non_na_idx = 0
813
-
814
813
ndarray[rank_t] sorted_data, values
815
-
816
814
ndarray[float64_t] ranks
817
815
ndarray[int64_t] argsorted
818
816
ndarray[uint8_t, cast= True ] sorted_mask
819
-
820
817
rank_t val, nan_value
821
-
822
818
float64_t sum_ranks = 0
823
819
int tiebreak = 0
824
- bint keep_na = 0
820
+ bint keep_na = False
825
821
bint isnan, condition
826
822
float64_t count = 0.0
827
823
@@ -1034,19 +1030,14 @@ def rank_2d(
1034
1030
"""
1035
1031
cdef:
1036
1032
Py_ssize_t i, j, z, k, n, dups = 0 , total_tie_count = 0
1037
-
1038
1033
Py_ssize_t infs
1039
-
1040
1034
ndarray[float64_t, ndim= 2 ] ranks
1041
1035
ndarray[rank_t, ndim= 2 ] values
1042
-
1043
1036
ndarray[int64_t, ndim= 2 ] argsorted
1044
-
1045
1037
rank_t val, nan_value
1046
-
1047
1038
float64_t sum_ranks = 0
1048
1039
int tiebreak = 0
1049
- bint keep_na = 0
1040
+ bint keep_na = False
1050
1041
float64_t count = 0.0
1051
1042
bint condition, skip_condition
1052
1043
0 commit comments