9951 explained code solutions for 126 technologies


python-numpyHow to transpose Numpy matrix


import numpy as np
mtx = np.array([[1, 2], [3, 4], [5, 6]])
transposed = mtx.Tctrl + c
import numpy as np

load Numpy module for Python

np.array

declare Numpy array

.T

returns transposed matrix from the specified one

transposed

will contain transposed matrix