NumPy ndarray.T | Get View of Transposed Array Last Updated : 31 Jan, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report The NumPy ndarray.T attribute finds the view of the transposed Array. It can transpose any array having a dimension greater than or equal to 2. It works similarly to the numpy.transpose() method but it is easy and concise to use. SyntaxSyntax: ndarray.T Returns Transpose of given arrayExamplesLet's look at how to use the ndarray.T attribute of the Python's NumPy library. Example 1 Python3 import numpy as np arr = np.array([[1, 2, 3], [4, 5, 6]]) # applying ndarray.T object transposed_array = arr.T print(transposed_array) Output[[1 4] [2 5] [3 6]] Example 2 Python3 # import the important module in python import numpy as np # make an array with numpy gfg = np.array([[1, 2, 3, 4], [4, 5, 6, 7], [7, 8, 9, 0]]) # applying ndarray.T object geeks = gfg.T print(geeks) Output: [[1 4 7] [2 5 8] [3 6 9] [4 7 0]] The ndarray.T attribute finds its use in machine learning applications where input data needs to be formatted in a certain way for further processing. It does not modify the original array and only returns the view of the transposed array. Comment More infoAdvertise with us Next Article Python | Numpy matrix.transpose() J jitender_1998 Follow Improve Article Tags : Numpy Python-numpy Python numpy-ndarray Similar Reads NumPy ndarray.transpose() Method | Find Transpose of the NumPy Array The ndarray.transpose() function returns a view of the array with axes transposed. For a 1-D array, this has no effect, as a transposed vector is simply the same vector.For a 2-D array, this is a standard matrix transpose.For an n-D array, if axes are given, their order indicates how the axes are pe 2 min read numpy.ndarray.view() in Python numpy.ndarray.view() helps to get a new view of array with the same data. Syntax: ndarray.view(dtype=None, type=None)Parameters: dtype : Data-type descriptor of the returned view, e.g., float32 or int16. The default, None, results in the view having the same data-type as a. type : Python type, opti 3 min read NumPy Copy and View of Array While working with NumPy, you may notice that some operations return a copy, while others return a view. A copy creates a new, independent array with its own memory, while a view shares the same memory as the original array. As a result, changes made to a view also affect the original and vice versa 4 min read Numpy MaskedArray.transpose() function | Python numpy.MaskedArray.transpose() function is used to permute the dimensions of an masked array. Syntax : numpy.ma.transpose(axis) Parameters: axis :[list of ints, optional] By default, reverse the dimensions, otherwise permute the axes according to the values given. Return : [ ndarray] Resultant array 2 min read Python | Numpy matrix.transpose() With the help of Numpy matrix.transpose() method, we can find the transpose of the matrix by using the matrix.transpose()method in Python. Numpy matrix.transpose() Syntax Syntax : matrix.transpose() Parameter: No parameters; transposes the matrix it is called on. Return : Return transposed matrix Wh 3 min read Python | Numpy numpy.transpose() With the help of Numpy numpy.transpose(), We can perform the simple function of transpose within one line by using numpy.transpose() method of Numpy. It can transpose the 2-D arrays on the other hand it has no effect on 1-D arrays. This method transpose the 2-D numpy array. Parameters: axes : [None, 2 min read Like