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
argsort gives wrong results #8757
Comments
Can't see anything wrong with the result, print out |
This is the second google result for "np argsort wrong". The explanation on the docs page is unclear (to me). I will add my own explanation here in the hopes that it helps someone:
Some people might expect this to instead give What it actually does is provide indices such that If you really want to get
Alternatively, if you're just really off-base like I was and only want, say, the indices of the 3 largest elements in
|
Doing this will be faster:
#9880 suggests adding this to numpy as |
The argsort function seems to be broken. Looking at the code provided, the argsort for rows [0, 1] is correct but it's messed up for rows [2, 3].
I tested this on different NumPy installations and versions 1.11.0 and 1.12.0
The text was updated successfully, but these errors were encountered: