You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Folks,
The default axis for argsort (method & function) is -1, when it's None for argmin and argmax.
Moreover, forcing the axis to None raises a TypeError: an integer is required exception.
>>>import numpy as N
>>>N.version.version
'1.0.1.dev3460'
>>>a=N.array([[1,3],[2,4]])
>>>N.argmin(a), N.argmax(a),
(0,3)
>>>N.argsort(a)
array([[0, 1],
[0, 1]])
>>>N.argsort(a,None)
/usr/lib64/python2.4/site-packages/numpy/core/fromnumeric.py in argsort(a, axis, kind)
192 except AttributeError:
193 return _wrapit(a, 'argsort', axis, kind)
--> 194 return argsort(axis, kind)
195
196 def argmax(a, axis=None):
TypeError: an integer is required
The text was updated successfully, but these errors were encountered:
argsort and sort are special cases because sort does an in-place sort. None has never been accepted for these. I suppose it could be, but we can't change the default axis at this point at least until 1.1 which will not be for a year or two.
It would be possible for argsort to accept None and (maybe) for sort to accept None as well.
Argsort now accepts None as does the sort function. The sort method is harder to write to accept None and seems like an odd beast (an in-place ravel). The default axis arguments will not change until possibly a later version of NumPy (at least 1.1)
Original ticket http://projects.scipy.org/numpy/ticket/391 on 2006-11-28 by @pierregm, assigned to unknown.
Folks,
The default axis for
argsort
(method & function) is -1, when it'sNone
forargmin
andargmax
.Moreover, forcing the axis to
None
raises aTypeError: an integer is required
exception.The text was updated successfully, but these errors were encountered: