Is this the kind of reordering you want?
In [128]: a=[[[11,12,13],[14,15,16]],[[21,22,23],[24,25,26]]]
In [129]: A=np.array(a)
In [130]: A
Out[130]:
array([[[11, 12, 13],
[14, 15, 16]],
[[21, 22, 23],
[24, 25, 26]]])
In [131]: A.reshape(-1,3).T
Out[131]:
array([[11, 14, 21, 24],
[12, 15, 22, 25],
[13, 16, 23, 26]])
A
is (2,2,3)
, and result is (3,4)
.
I reshaped it into (4,3)
, and then transposed the 2 axes.
Sometimes questions like this are confusing, especially if they don't have a concrete example to test. If I didn't get it right, I made need to apply the transpose first, with a full specification.
e.g.
In [136]: A.transpose([2,0,1]).reshape(3,-1)
Out[136]:
array([[11, 14, 21, 24],
[12, 15, 22, 25],
[13, 16, 23, 26]])
If you have lists, as opposed an array, the task will be more difficult. There is an easy idiom for 'transposing' a '2d' nested list, but it might not apply to '3d'.
In [137]: zip(*a)
Out[137]: [([11, 12, 13], [21, 22, 23]), ([14, 15, 16], [24, 25, 26])]
(ok, the other answer has the non-array solution).