get index of smallest element in numpy array code example
Example 1: python min value index from an array
if isMinLevel:
return values.index(min(values))
else:
return values.index(max(values))
Example 2: numpy get index of n largest values
numbers = np.array([1, 3, 2, 4])
n = 2
indices = (-numbers).argsort()[:n]