Write a NumPy program to move axes of an array to new positions. Other axes remain in their original order
import numpy as np x = np.zeros((2, 3, 4)) print(np.moveaxis(x, 0, -1).shape) print(np.moveaxis(x, -1, 0).shape)
Sample Output:
(3, 4, 2) (4, 2, 3)
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer