numpy.moveaxis() function | Python
numpy.moveaxis() function move axes of an array to new positions. Other axes remain in their original order.
Syntax : numpy.moveaxis(arr, source, destination)
arr : [ndarray] input array.
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.
Return : [ndarray] Array with moved axes. This array is a view of the input array.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
Code #1 :
(2, 3, 4, 1)
Code #2 :
(4, 1, 2, 3)