10000 argsort default axis + axis=None (Trac #391) · Issue #989 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

argsort default axis + axis=None (Trac #391) #989

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
numpy-gitbot opened this issue Oct 19, 2012 · 2 comments
Closed

argsort default axis + axis=None (Trac #391) #989

numpy-gitbot opened this issue Oct 19, 2012 · 2 comments

Comments

@numpy-gitbot
Copy link

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'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
@numpy-gitbot
Copy link
Author

@teoliphant wrote on 2006-12-01

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.

Bring it up on the list.

@numpy-gitbot
Copy link
Author

@teoliphant wrote on 2006-12-02

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant
0