The ndarray.T in Python is used to obtain the transpose of a given array.
Transpose: The transpose of a matrix is the process of interchanging the row of a matrix with the column and vice-versa.
Below is an illustration of how the transpose of an array works.
Let's have a look at the syntax of ndarray.T.
ndarray.T
The ndarray.T attribute does not take any parameter value.
The ndarray.T return the array holding the transpose of an input array.
import numpy as np# creating an input arraymyarray = np.array([[1,2,3], [4,5,6]])# printing the input arrayprint(myarray)# implementing the ndarray.T attributeprint(myarray.T)
numpy module.myarray, using the array() function.myarray.ndarray.T attribute.