Inverse numpy.argsort

490 Views Asked by At

I have a list of floats and I want to know their index if I were to sort them. Numpy has a function that almost does what I want: argsort. Here is an example from the manual:

x = np.array([3, 1, 2])

np.argsort(x) # array([1, 2, 0])

For what I need it should rather be array([2, 0, 1])

This seems to be a simple question yet I found no one online that wants to do that. What do I need?

0

There are 0 best solutions below