Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

NumPy: ndarray.T() function

numpy.ndarray.T() function

Permute the dimensions of an array except that self is returned if self.ndim < 2.

Syntax:

ndarray.T
NumPy manipulation: ndarray-t() function

Version: 1.15.0

Syntax:

ndarray.T

Example-1: numpy.ndarray.T()

>>> import numpy as np
>>> a = np.array([[2.,3.],[4.,5.]])
>>> a
array([[ 2.,  3.],
       [ 4.,  5.]])

Pictorial Presentation:

NumPy manipulation: ndarray-t() function

Example-2: numpy.ndarray.T()

>>> import numpy as np
>>> a = np.array([[2.,3.],[4.,5.]])
>>> a.T
array([[ 2.,  4.],
       [ 3.,  5.]])

Pictorial Presentation:

NumPy manipulation: ndarray-t() function

Example-3: numpy.ndarray.T()

>>> import numpy as np
>>> a = np.array([2.,3.,4.,5.])
>>> a
array([ 2.,  3.,  4.,  5.])
>>> a.T
array([ 2.,  3.,  4.,  5.])

Python - NumPy Code Editor:

Previous: swapaxes()
Next: transpose()