I'm trying to split an array into two pieces and have the two pieces in a new dimension.
Here it is in code, because that's hard to explain in words.
(4, 50, 3)
new_data = numpy.zeros((2, 4, 25, 3)) new_data[0,...] = data[:,:25,:] new_data[1,...] = data[:,25:,:] new_data.shape
(2, 4, 25, 3)
That works but when I try it with reshape the elements get in the wrong place. I've tried various combinations of rollaxis before the reshape, but can't get it right.