In this chapter, we will discuss about NumPy – ndarray.T. This function belongs to the ndarray class. It behaves similar to numpy.transpose.
Example Of NumPy ndarray.T
import numpy as np a = np.arange(12).reshape(3,4) print 'The original array is:' print a print '\n' print 'Array after applying the function:' print a.T
The output of the above program would be −
The original array is: [[ 0 1 2 3] [ 4 5 6 7] [ 8 9 10 11]] Array after applying the function: [[ 0 4 8] [ 1 5 9] [ 2 6 10] [ 3 7 11]]
Next Topic – Click Here
Pingback: NumPy Array Manipulation - Adglob Infosystem Pvt Ltd
Pingback: NumPy - transpose - Adglob Infosystem Pvt Ltd ......