numpy.moveaxis() function with example program in python
numpy.moveaxis(): This function move axes of an array to new positions.
Syntax: numpy.moveaxis(a, source, destination)
Other axes remain in their original order.
New in version 1.11.0.
Parameters:
a : np.ndarray
The array whose axes should be reordered.
source : int or sequence of int
Original positions of the axes to move. These must be unique.
destination : int or sequence of int
Destination positions for each of the original axes. These must also be unique.
Returns:
result : np.ndarray
Array with moved axes. This array is a view of the input array.
import numpy as np
a= np.array([[1,2],[2,3],[3,4]])
print(a.shape)
np.moveaxis(a, 5,3).shape
print(a.shape)