How to find transpose of a matrix in Python using NumPy
You can find the transpose of a matrix in Python using NumPy with the following code. If you want to learn Python then I will highly recommend you to read This Book.
Transpose of a Matrix
In the following example, first, make a NumPy array and save it in variable ‘a’. Then find the transpose of matrix ‘a’ and save it in the variable ‘b’.
#import NumPy library
import numpy as np
#Make a numpy array
a = np.array([[31,22,43],[54,65,19],[10,8,98],[14,72,31]])
#save the transpose of a in b
b = a.T