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
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:
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:
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()
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework