In order to find the index of the smallest value, I can use argmin:
argmin
import numpy as np A = np.array([1, 7, 9, 2, 0.1, 17, 17, 1.5]) print A.arg
You can use numpy.argsort with slicing
>>> import numpy as np >>> A = np.array([1, 7, 9, 2, 0.1, 17, 17, 1.5]) >>> np.argsort(A)[:3] array([4, 0, 7], dtype=int32)