NumPy transpose

1 개요[ | ]

NumPy transpose
Python
CPU
3.5s
MEM
69M
3.8s
Reload
Copy
import numpy as np
x = np.arange(4).reshape((2,2))
x
array([[0, 1],
       [2, 3]])
Copy
np.transpose(x)
array([[0, 2],
       [1, 3]])
Copy
x = np.ones((1, 2, 3))
x
array([[[1., 1., 1.],
        [1., 1., 1.]]])
Copy
np.transpose(x, (1, 0, 2))
array([[[1., 1., 1.]],

       [[1., 1., 1.]]])
Copy
np.transpose(x, (1, 0, 2)).shape
(2, 1, 3)
Copy
x = np.ones((2, 3, 4, 5))
np.transpose(x).shape
(5, 4, 3, 2)

2 같이 보기[ | ]

3 참고[ | ]