Skip to main content

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]]
Submitted by devanshi.srivastava on November 15, 2021

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


At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.