How to transpose the higher dimension matrix in Ipython?

ipython

#1

I have created a matrix of three dimension and after the creation of matrix when I have transpose the matrix .

In [115]: arr = np.arange(16).reshape((2, 2, 4))
In [116]: arr
Out[116]:
array([[[ 0, 1, 2, 3],
[ 4, 5, 6, 7]],
[[ 8, 9, 10, 11],
[12, 13, 14, 15]]])
In [117]: arr.transpose((1, 0, 2))
Out[117]:
array([[[ 0, 1, 2, 3],
[ 8, 9, 10, 11]],
[[ 4, 5, 6, 7],
[12, 13, 14, 15]]]) 

I am not able to understand the result of it.

Thanks,
Harry


#2

@harry-
It is a 3-D matrix.So there will be three axes (0,1,2) and here you are doing transpose of axis 0 and axis 1 and keeping third axis (2).

Hope this helps!

Regards,
Hinduja