The first output is correct. But somehow argsort
gives wrong output for the second array:
>>> np.argsort(np.array([ 0.62678927, 0.36816272, 0.31044763, 0.44873312, 0.3101446 ]))
array([4, 2, 1, 3, 0])
>>> np.argsort(np.array([ 0.36816272, 0.62678927, 0.13509969, 0.54590815, 0.13493432]))
array([4, 2, 0, 3, 1])
After spending 2 hours on it, I'm convinced that this problem is either too trivial or too technical. I'm using Anaconda virtual environments and have tested it with numpy 1.11.3 and 1.10.4