Skip to content
Browse files

slow rankdata/nanrankdata should use np.asarray

The other slow functions do this, and it was causing a test failure in
Python 3 when called with [] (since it tried to access .ndim, which
doesn't exist). I don't know why this isn't an error in Python 2...?
  • Loading branch information...
1 parent 8b39a94 commit 3d34f5029c90bfab8ac49b1b02c89343aeda3d64 @dougalsutherland dougalsutherland committed
Showing with 2 additions and 0 deletions.
  1. +2 −0 bottleneck/slow/func.py
View
2 bottleneck/slow/func.py
@@ -107,6 +107,7 @@ def nanargmax(arr, axis=None):
def rankdata(arr, axis=None):
"Slow rankdata function used for unaccelerated ndim/dtype combinations."
+ arr = np.asarray(arr)
if axis is None:
arr = arr.ravel()
axis = 0
@@ -122,6 +123,7 @@ def rankdata(arr, axis=None):
def nanrankdata(arr, axis=None):
"Slow nanrankdata function used for unaccelerated ndim/dtype combinations."
+ arr = np.asarray(arr)
if axis is None:
arr = arr.ravel()
axis = 0

0 comments on commit 3d34f50

Please sign in to comment.
Something went wrong with that request. Please try again.