I'm trying to mimic the combination of the aa and bb arrays shown below using zip() within a for block:
import numpy as np
aa = np.random.uniform(0., 1., (3, 566))
bb = np.random.uniform(0., 1., (3, 566))
cc = []
for a, b in list(zip(list(zip(*aa)), list(zip(*bb)))):
cc.append(list(zip(*[a, b])))
cc = np.array(cc)
print(cc.shape)
(566, 3, 2)
I've tried vstack, hstack, column_stack, all of them combined with .reshape() to no avail. Obviously, not only the final shape should be equal, but the array itself too.
What is the proper numpy way to do this?
stack: np.stack([aa,bb],1).transpose(2,0,1)`. This gets the (3,2) order right, and then transposes the 566 to the start.