Assume the following arrays are given:
a = array([[[4, 7, 1],
[3, 8, 1],
[0, 3, 7],
[1, 5, 5],
[1, 7, 6]],
[[8, 1, 0],
[2, 1, 4],
[1, 7, 2],
[6, 2, 0],
[3, 2, 6]],
[[4, 3, 1],
[0, 3, 9],
[1, 6, 2],
[6, 5, 7],
[1, 3, 2]],
[[7, 3, 7],
[8, 1, 3],
[9, 9, 4],
[2, 6, 8],
[4, 4, 5]],
[[4, 8, 1],
[2, 0, 3],
[4, 8, 9],
[3, 7, 2],
[7, 3, 1]]])
b = array([[[8, 3, 2],
[1, 7, 9],
[0, 0, 6],
[1, 0, 1],
[6, 0, 2]],
[[1, 0, 0],
[8, 6, 9],
[8, 2, 2],
[6, 6, 5],
[2, 0, 8]],
[[6, 2, 4],
[4, 5, 4],
[4, 7, 4],
[3, 7, 8],
[0, 9, 5]],
[[7, 9, 0],
[5, 4, 9],
[7, 5, 9],
[0, 0, 5],
[4, 7, 2]],
[[0, 2, 0],
[4, 7, 7],
[6, 7, 6],
[2, 5, 3],
[6, 0, 5]]])
How can i interleave the row to get shape to be (5, 5, 6) and the value on the last axis to be
4, 8, 7, 3, 1, 2
This is repeated for the rest of the row. I have tried examples from Interweaving two numpy arrays but it doesn't work since the reshape cause the shape mismatch. A numpy solution would be greatly appreciated.