Q:

Write a NumPy program to move axes of an array to new positions. Other axes remain in their original order

0

Write a NumPy program to move axes of an array to new positions. Other axes remain in their original order

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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)

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now