How to get the transpose of a NumPy array in Python

The transpose of a multi-dimensional NumPy array is an array in which the rows and columns are interchanged. For example, the transpose of [[1 2 3] [4 5 6] [7 8 9]] is [[1 4] [2 5] [3 6]].

Solution for How to get the transpose of a NumPy array in Python : You can use numpy.ndarray.T to get the transpose Call numpy.ndarray.T to return the transpose of numpy.ndarrray.


how-to-get-the-transpose-of-a-numpy-array-in-python