Python | Numpy matrix.max ()

NumPy | Python Methods and Functions

Using the Numpy matrix.max () method, we can get the maximum value from a given matrix.

Syntax: matrix.max()

Return: Return maximum value from a given matrix

Example # 1:
In this example, we see that we can get the maximum value from a given matrix using the matrix method .max () .

# import important module into python

import numpy as np

  
# make a matrix with NumPy

gfg = np.matrix ( `[64, 1; 12, 3]` )

 
# applying the method matrix.max ()

geeks = gfg. max ()

 

print (geeks)

Exit :

 64 

Example # 2:

# import an important module in python

import numpy as np

 
# make a matrix with NumPy

gfg = np.matrix ( ` [1, 2, 3; 4, 5, 6; 7, 8, 9] ` )

  
# using the matrix.max () method

geeks = gfg. max ()

 

print (geeks)

Exit:

 9 




Get Solution for free from DataCamp guru