Have you ever tried to find maximum and minimum value in matrix? So lets see how we can do this.
So this is the recipe on how we can find Maximum and Minimum values in a Matrix.
import numpy as np
We have only imported numpy which is needed.
We have created a 4 x 4 matrix using array.
matrix_101 = np.array([[10, 11, 12, 23],
[4, 5, 6, 25],
[7, 8, 9, 28],
[1, 2, 3, 41]])
We can find the maximum and minimum values by using the function max and min respectively. We can also pass axis as a parameter which will help us to find maximum or minimum values of every rows and column.
print(); print(np.max(matrix_101, axis=1))
So the output comes as
41 1 [10 11 12 41] [23 25 28 41]