Python | Numpy matrix.mean ()

Using the Numpy matrix.mean () method we can get the average value from a given matrix.

Syntax: matrix.mean()

Return: Return mean value from a given matrix

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

# import important module into python

import numpy as np

  
# make a matrix with NumPy

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

 
# applying the matrix method .mean ()

geeks = gfg .mean ()

 

print (geeks)

Output:

 20.0 

Example # 2:

# import important module into 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.mean () method

geeks = gfg.mean ()

 

print (geeks)

Exit :

 5.0