There is a number of questions out here concerning sorting arrays but I was not able to find the one solving my problem (which makes me hope that I'm not thinking way to complicated). So here we go:
I have two arrays with equal values but in different order:
a = np.array([4, 2, 5, 6])
# b = np.random.permutation(a) # general case
b = np.array([5, 2, 6, 4])
I need the indices that sort b to a, so here:
ind = np.array([3, 1, 0, 2])
Note that I do not want to change a.