Description : NumPy generally stands for Numerical Python and it is a general purpose array processing package.it always provides a high performance multidimensional array object.Numpy is usually for creating array of n dimensions
Method Name :numpy.moveaxis(a, source, destination)
Description :The function move axes of an array to new positions. the other axes remain in the original order.
In this article, i will tell you about the parameter and its description
Parameter Name: arr
Description :np.ndarray
The array whose axes should be reordered.
Parameter Name:source
Description : int or sequence of int
Original positions of the axes to move. These must be unique.
Parameter Name: destination
Description : int or sequence of int
Destination positions for each of the original axes. These must also be unique.
Return :np.ndarray
Array with moved axes. This array is a view of the input array.
The first step would be to give syntax
command:
numpy.moveaxis(arr, source, destination)
import numpy as np
arr = np.zeros((5,7,6,8))
abc = np.moveaxis(arr, -1, 0).shape
print (abc)
Output :
Example :
Code :
import numpy as np
arr = np.zeros((5,7,6,8))
abc = np.moveaxis(arr, 0, -1).shape
print (abc)
Comments