@@ -24,7 +24,7 @@ dtypes = [('object', 'object', 'Infinity()', 'NegInfinity()'),
24
24
25
25
@cython.wraparound(False)
26
26
@cython.boundscheck(False)
27
- def rank_1d_{{dtype}}(object in_arr, ties_method='average',
27
+ def rank_1d_{{dtype}}({{ctype}}[:] in_arr, ties_method='average',
28
28
ascending=True, na_option='keep', pct=False):
29
29
"""
30
30
Fast NaN-friendly version of scipy.stats.rankdata
@@ -189,7 +189,7 @@ def rank_1d_{{dtype}}(object in_arr, ties_method='average',
189
189
return ranks
190
190
191
191
192
- def rank_2d_{{dtype}}(object in_arr, axis=0, ties_method='average',
192
+ def rank_2d_{{dtype}}({{ctype}}[:, :] in_arr, axis=0, ties_method='average',
193
193
ascending=True, na_option='keep', pct=False):
194
194
"""
195
195
Fast NaN-friendly version of scipy.stats.rankdata
@@ -226,12 +226,10 @@ def rank_2d_{{dtype}}(object in_arr, axis=0, ties_method='average',
226
226
227
227
keep_na = na_option == 'keep'
228
228
229
- in_arr = np.asarray(in_arr)
230
-
231
229
if axis == 0:
232
- values = in_arr.T.copy()
230
+ values = np.asarray( in_arr) .T.copy()
233
231
else:
234
- values = in_arr.copy()
232
+ values = np.asarray( in_arr) .copy()
235
233
236
234
{{if dtype == 'object'}}
237
235
if values.dtype != np.object_:
0 commit comments