Python NumPy: Interchange two axes of an array
Python NumPy: Array Object Exercise-51 with Solution
Write a Python program to interchange two axes of an array.
import numpy as np x = np.array([[1,2,3]]) print(x) y = np.swapaxes(x,0,1) print(y)
[[1 2 3]] [  ]
Python Code Editor:
Improve this sample solution and post your code through Disqus