Python | Numpy matrix.transpose ()

NumPy | Python Methods and Functions

Using the Numpy matrix.transpose () method, we can find the transpose of a matrix using matrix.transpose () .

Syntax: matrix.transpose ()
Return: Return transposed matrix

Example # 1:
In this example we can see that using matrix.transpose () we can find the transposition of the given matrix.

# import an important module into python

import numpy as np

 
# make a matrix with NumPy

gfg = np.matrix ( `[4, one; 12, 3] ` )

  
# applying the matrix.transpose () method

geek = gfg.transpose ()

 

print (geek)

Output:

 [[4 12] [1 3]] 

Example # 2:

# import important module in python

import numpy as np

 
# make a matrix with NumPy

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

  
# applying the matrix.transpose () method

geek = gfg.transpose ()

 

print (geek)

Exit:

 [[4 12 4] [1 3 5] [9 1 6]] 




Get Solution for free from DataCamp guru