NumPy Array manipulation: transpose() function

In Python Numpy transpose() function is used to perform transpose. It can transpose 2-D array.  In mathematics matrix transpose is used to convert rows into column and vice-versa.Therefore in Numpy array transposing simply convert rows into columns and columns into rows.


numpy.transpose(a, axes=None)


import numpy as np
A= np.array([[1,2,3],
print(A.transpose())#After Transpose


[[1 4 7]
 [2 5 8]
 [3 6 9]]
Mon, 11/15/2021 - 06:47

Authored by

Devanshi, is working as a Data Scientist with iVagus. She has expertise in Python, NumPy, Pandas and other data science technologies.