I've been stuck on this numpy operation for a while now. I have an np.array of np.shape (x, y, z) that I want to make into an array of np.shape (y, x, z). I am having a hard time understanding the order on which np.reshape is done. For instance, I would like the values to be grouped by their index in the 2nd dim, and not on the first dimension.
For example, with this array of np.shape (3, 2, 9):
[[[-25 -25 15 -26 -26 0 -26 -26 3]
[ -8 -2 0 -21 -9 39 -14 -11 2]]
[[-25 2 18 -26 -10 10 -26 -15 14]
[ -8 -2 0 -21 -9 39 -14 -11 2]]
[[-25 2 18 -26 -10 14 -26 -15 5]
[ -8 -2 3 -21 -9 18 -14 -11 3]]]
I would like the output of np.shape (2,3,9) to be:
[[[-25 -25 15 -26 -26 0 -26 -26 3]
[-25 2 18 -26 -10 10 -26 -15 14]
[-25 2 18 -26 -10 14 -26 -15 5]]
[[ -8 -2 0 -21 -9 39 -14 -11 2]
[ -8 -2 0 -21 -9 39 -14 -11 2]
[ -8 -2 3 -21 -9 18 -14 -11 3]]]
And not :
[[[-25 -25 15 -26 -26 0 -26 -26 3]
[ -8 -2 0 -21 -9 39 -14 -11 2]
[-25 2 18 -26 -10 10 -26 -15 14]]
[[ -8 -2 0 -21 -9 39 -14 -11 2]
[-25 2 18 -26 -10 14 -26 -15 5]
[ -8 -2 3 -21 -9 18 -14 -11 3]]]
I know this is basic numpy but so far every combination of order='F', array.T, etc got me no luck. Appreciate any help!