numpy array index of max code example
Example 1: max of matrix numpy
# Get the maximum element from a Numpy array
maxElement = numpy.amax(arr)
print('Max element from Numpy Array : ', maxElement)
Example 2: numpy get index of n largest values
numbers = np.array([1, 3, 2, 4])
n = 2
indices = (-numbers).argsort()[:n]