numpy permute axis code example
Example 1: python numpy array change axis
>>> x = np.array([[1,2,3]])
>>> np.swapaxes(x,0,1)
array([[1],
[2],
[3]])
Example 2: numpy transpose
>>> np.transpose(x)
array([[0, 2],
[1, 3]])
>>> x = np.array([[1,2,3]])
>>> np.swapaxes(x,0,1)
array([[1],
[2],
[3]])
>>> np.transpose(x)
array([[0, 2],
[1, 3]])