vals = numpy.array([2,3,1,4,5]) sort_index = numpy.argsort(vals) >>> sort_index array([2, 0, 1, 3, 4])