Hi is there a way to efficiently stack the same row in each layer of a 3D numpy array? I have an array like this:
a = np.array([[["a111","a112","a113"],
["b","b","b"],
["c","c","c"],
["d","d","d"]],
[["a211","a212","a213"],
["b","b","b"],
["c","c","c"],
["d","d","d"]],
[["a311","a312","a313"],
["b","b","b"],
["c","c","c"],
["d","d","d"]],
[["a411","a412","a413"],
["b","b","b"],
["c","c","c"],
["d","d","d"]]])
and i want to get something like this:
np.array([[["a111","a112","a113"],
["a211","a212","a213"],
["a311","a312","a313"],
["a411","a412","a413"]],
[["b","b","b"],
["b","b","b"],
["b","b","b"],
["b","b","b"]],
[["c","c","c"],
["c","c","c"],
["c","c","c"],
["c","c","c"]],
[["d","d","d"],
["d","d","d"],
["d","d","d"],
["d","d","d"]]])
Right now I'm looping through the whole array and stacking it manually.