By including the axis argument, NumPy takes a gander at the rows and columns separately. At the point when it's not given, the array is straightened into a solitary(single) 1D array.
axis=0 implies that the activity is performed down the columns of a 2D array thusly.
For instance, np.argmin(a, axis=0) restores the index of the base value in every one of the four columns. The base value(Minimum value) in every segment is appeared in below:
>>> a
array([[ 1, 2, 4, 7], # 0
[ 9, 88, 6, 45], # 1
[ 9, 76, 3, 4]]) # 2
>>> np.argmin(a, axis=0)
array([0, 0, 2, 2])
Then again, axis=1 implies that the activity is performed across the rows of a.
That implies np.argmin(a, axis=1) which returns [0, 2, 2] because that a has three rows. 0 is the index of the minimum value from the first row, the index of the base balue of the second and third lines is 2:
>>> a
# 0 1 2 3
array([[ 1, 2, 4, 7],
[ 9, 88, 6, 45],
[ 9, 76, 3, 4]])
>>> np.argmin(a, axis=1)
array([0, 2, 2])
Join the python certification course and get a chance to learn python in detail.