transpose of matrix python code example
Example 1: transpose matrices numpy
import numpy as np
A = [1, 2, 3, 4]
np.array(A).T # .T is used to transpose matrix
Example 2: transpose matrix python
arr = list(list(x) for x in zip(*arr))
Example 3: transpose of a matrix using numpy
M = np.matrix([[1,2],[3,4]])
M.transpose()