numpy argmax function in Python

numpy argmax in Python is find the array matrix and show the index value In many cases, where the size of the array is too large, it takes too much time to find the maximum elements from them. For this purpose, the numpy module of Python provides a function called numpy.argmax(). import numpy as np x = np.arange(20).reshape(4,5) + 7 print(x) y=np.argmax(x, axis=0) z=np.argmax(x, axis=1) print(y) print(z) 0 1 2 3 4 0 [7 8 9 10 11] 1 [12 13 14 15 16] 2 [17 18 19 20 21] 3 [22 23 24 25 26] output [[ 7 8 9 10 11] [12 13 14 15 16] [17 18 19 20 21] [22 23 24 25 26]] [3 3 3 3 3] [4 4 4 4]

Comments