@@ -59,11 +59,11 @@ cdef:
5959 int TIEBREAK_DENSE = 5
6060
6161tiebreakers = {
62- ' average' : TIEBREAK_AVERAGE,
63- ' min' : TIEBREAK_MIN,
64- ' max' : TIEBREAK_MAX,
65- ' first' : TIEBREAK_FIRST,
66- ' dense' : TIEBREAK_DENSE,
62+ ' average' : TIEBREAK_AVERAGE,
63+ ' min' : TIEBREAK_MIN,
64+ ' max' : TIEBREAK_MAX,
65+ ' first' : TIEBREAK_FIRST,
66+ ' dense' : TIEBREAK_DENSE,
6767}
6868
6969
@@ -489,7 +489,6 @@ def rank_1d_generic(object in_arr, bint retry=1, ties_method='average',
489489 bint keep_na = 0
490490 float count = 0.0
491491
492-
493492 tiebreak = tiebreakers[ties_method]
494493
495494 keep_na = na_option == ' keep'
@@ -578,6 +577,7 @@ class Infinity(object):
578577 __gt__ = lambda self , other : self is not other
579578 __ge__ = lambda self , other : True
580579
580+
581581class NegInfinity (object ):
582582 """ provide a negative Infinity comparision method for ranking """
583583
@@ -705,7 +705,6 @@ def rank_2d_generic(object in_arr, axis=0, ties_method='average',
705705# return result
706706
707707
708-
709708cdef inline Py_ssize_t swap(numeric * a, numeric * b) nogil except - 1 :
710709 cdef numeric t
711710
@@ -747,11 +746,11 @@ cpdef numeric kth_smallest(numeric[:] a, Py_ssize_t k):
747746
748747cdef inline kth_smallest_c(float64_t* a, Py_ssize_t k, Py_ssize_t n):
749748 cdef:
750- Py_ssize_t i,j,l, m
749+ Py_ssize_t i, j, l, m
751750 double_t x, t
752751
753752 l = 0
754- m = n- 1
753+ m = n - 1
755754 while (l< m):
756755 x = a[k]
757756 i = l
@@ -793,13 +792,13 @@ cpdef numeric median(numeric[:] arr):
793792
794793def max_subseq (ndarray[double_t] arr ):
795794 cdef:
796- Py_ssize_t i= 0 ,s= 0 ,e= 0 ,T, n
795+ Py_ssize_t i= 0 , s= 0 , e= 0 , T, n
797796 double m, S
798797
799798 n = len (arr)
800799
801800 if len (arr) == 0 :
802- return (- 1 ,- 1 ,None )
801+ return (- 1 , - 1 , None )
803802
804803 m = arr[0 ]
805804 S = m
@@ -819,6 +818,7 @@ def max_subseq(ndarray[double_t] arr):
819818
820819 return (s, e, m)
821820
821+
822822def min_subseq (ndarray[double_t] arr ):
823823 cdef:
824824 Py_ssize_t s, e
@@ -831,6 +831,7 @@ def min_subseq(ndarray[double_t] arr):
831831# ----------------------------------------------------------------------
832832# Pairwise correlation/covariance
833833
834+
834835@ cython.boundscheck (False )
835836@ cython.wraparound (False )
836837def nancorr (ndarray[float64_t , ndim = 2 ] mat, cov = False , minp = None ):
@@ -890,6 +891,7 @@ def nancorr(ndarray[float64_t, ndim=2] mat, cov=False, minp=None):
890891# ----------------------------------------------------------------------
891892# Pairwise Spearman correlation
892893
894+
893895@ cython.boundscheck (False )
894896@ cython.wraparound (False )
895897def nancorr_spearman (ndarray[float64_t , ndim = 2 ] mat, Py_ssize_t minp = 1 ):
@@ -953,6 +955,7 @@ def nancorr_spearman(ndarray[float64_t, ndim=2] mat, Py_ssize_t minp=1):
953955# ----------------------------------------------------------------------
954956# group operations
955957
958+
956959@ cython.wraparound (False )
957960@ cython.boundscheck (False )
958961def is_lexsorted (list list_of_arrays ):
@@ -967,16 +970,14 @@ def is_lexsorted(list list_of_arrays):
967970
968971 cdef int64_t ** vecs = < int64_t** > malloc(nlevels * sizeof(int64_t* ))
969972 for i from 0 <= i < nlevels:
970- # vecs[i] = <int64_t *> (<ndarray> list_of_arrays[i]).data
971-
972973 arr = list_of_arrays[i]
973- vecs[i] = < int64_t * > arr.data
974- # assume uniqueness??
974+ vecs[i] = < int64_t* > arr.data
975975
976+ # Assume uniqueness??
976977 for i from 1 <= i < n:
977978 for k from 0 <= k < nlevels:
978979 cur = vecs[k][i]
979- pre = vecs[k][i- 1 ]
980+ pre = vecs[k][i - 1 ]
980981 if cur == pre:
981982 continue
982983 elif cur > pre:
@@ -988,7 +989,8 @@ def is_lexsorted(list list_of_arrays):
988989
989990
990991@ cython.boundscheck (False )
991- def groupby_indices (dict ids , ndarray[int64_t] labels , ndarray[int64_t] counts ):
992+ def groupby_indices (dict ids , ndarray[int64_t] labels ,
993+ ndarray[int64_t] counts ):
992994 """
993995 turn group_labels output into a combined indexer maping the labels to
994996 indexers
@@ -1020,7 +1022,7 @@ def groupby_indices(dict ids, ndarray[int64_t] labels, ndarray[int64_t] counts):
10201022 for i from 0 <= i < len (counts):
10211023 arr = np.empty(counts[i], dtype = np.int64)
10221024 result[ids[i]] = arr
1023- vecs[i] = < int64_t * > arr.data
1025+ vecs[i] = < int64_t* > arr.data
10241026
10251027 for i from 0 <= i < n:
10261028 k = labels[i]
@@ -1036,6 +1038,7 @@ def groupby_indices(dict ids, ndarray[int64_t] labels, ndarray[int64_t] counts):
10361038 free(vecs)
10371039 return result
10381040
1041+
10391042@ cython.wraparound (False )
10401043@ cython.boundscheck (False )
10411044def group_labels (ndarray[object] values ):
@@ -1116,6 +1119,7 @@ def groupsort_indexer(ndarray[int64_t] index, Py_ssize_t ngroups):
11161119# ----------------------------------------------------------------------
11171120# first, nth, last
11181121
1122+
11191123@ cython.boundscheck (False )
11201124@ cython.wraparound (False )
11211125def group_nth_object (ndarray[object , ndim = 2 ] out,
@@ -1160,6 +1164,7 @@ def group_nth_object(ndarray[object, ndim=2] out,
11601164 else :
11611165 out[i, j] = resx[i, j]
11621166
1167+
11631168@ cython.boundscheck (False )
11641169@ cython.wraparound (False )
11651170def group_nth_bin_object (ndarray[object , ndim = 2 ] out,
@@ -1210,6 +1215,7 @@ def group_nth_bin_object(ndarray[object, ndim=2] out,
12101215 else :
12111216 out[i, j] = resx[i, j]
12121217
1218+
12131219@ cython.boundscheck (False )
12141220@ cython.wraparound (False )
12151221def group_last_object (ndarray[object , ndim = 2 ] out,
@@ -1252,6 +1258,7 @@ def group_last_object(ndarray[object, ndim=2] out,
12521258 else :
12531259 out[i, j] = resx[i, j]
12541260
1261+
12551262@ cython.boundscheck (False )
12561263@ cython.wraparound (False )
12571264def group_last_bin_object (ndarray[object , ndim = 2 ] out,
@@ -1326,7 +1333,6 @@ cdef inline float64_t _median_linear(float64_t* a, int n):
13261333 a = tmp
13271334 n -= na_count
13281335
1329-
13301336 if n % 2 :
13311337 result = kth_smallest_c( a, n / 2 , n)
13321338 else :
0 commit comments