Q:

Write a NumPy program to interchange two axes of an array

0

Write a NumPy program to interchange two axes of an array.

All Answers

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

import numpy as np
x = np.array([[1,2,3]])
print(x)
y =  np.swapaxes(x,0,1)
print(y)

Sample Output:

[[1 2 3]]                                                              
[[1]                                                                   
 [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