- NumPy Tutorial
- NumPy - Home
- NumPy - Introduction
- NumPy - Environment
- NumPy - Ndarray Object
- NumPy - Data Types
- NumPy - Array Attributes
- NumPy - Array Creation Routines
- NumPy - Array from Existing Data
- Array From Numerical Ranges
- NumPy - Indexing & Slicing
- NumPy - Advanced Indexing
- NumPy - Broadcasting
- NumPy - Iterating Over Array
- NumPy - Array Manipulation
- NumPy - Binary Operators
- NumPy - String Functions
- NumPy - Mathematical Functions
- NumPy - Arithmetic Operations
- NumPy - Statistical Functions
- Sort, Search & Counting Functions
- NumPy - Byte Swapping
- NumPy - Copies & Views
- NumPy - Matrix Library
- NumPy - Linear Algebra
- NumPy - Matplotlib
- NumPy - Histogram Using Matplotlib
- NumPy - I/O with NumPy
- NumPy Useful Resources
- NumPy Compiler
- NumPy - Quick Guide
- NumPy - Useful Resources
- NumPy - Discussion
numpy.transpose
This function permutes the dimension of the given array. It returns a view wherever possible. The function takes the following parameters.
numpy.transpose(arr, axes)
Where,
Sr.No. | Parameter & Description |
---|---|
1 | arr The array to be transposed |
2 | axes List of ints, corresponding to the dimensions. By default, the dimensions are reversed |
Example
import numpy as np a = np.arange(12).reshape(3,4) print 'The original array is:' print a print '\n' print 'The transposed array is:' print np.transpose(a)
Its output would be as follows −
The original array is: [[ 0 1 2 3] [ 4 5 6 7] [ 8 9 10 11]] The transposed array is: [[ 0 4 8] [ 1 5 9] [ 2 6 10] [ 3 7 11]]
numpy_array_manipulation.htm
Advertisements
To Continue Learning Please Login
Login with Google