J. Doe
0
Q:

argmax in python

# Description: 
# numpy.argmax(array, axis=None, out=None) 
# Returns indices of the max element of the array in a particular axis

# Example:
import numpy as np
array =
[[ 0  11]
 [ 4  5]]

print("\nMax element : ", np.argmax(array)) 
# Output => Max element :  11

print("\nIndices of Max element : ", np.argmax(array, axis = 0)) 
# Output => Indices of Max element for each column :  [1, 0]

print("\nIndices of Max element : ", np.argmax(array, axis = 1)) 
# Output => Indices of Max element for each row :  [1 1]
2
argmax returns index of max value.
0

New to Communities?

Join the community