title: Reshape 4D numpy array into 3D
body: <p>I have a numpy array with the following dimensions - (256, 128, 4, 200) - basically the first two can form an image, the third is channels and the fourth is frames ("time instances"). How can I reshape the array so the frames are "stacked" one after the other, in other words the array would have a shape of (256, 128*200, 4)? It is important that the concatenating is frame-wise, so the order of the values in a frame is preserved.</p>
  
  <p>Essentially, what is needed is to optimize:</p>
  
  <pre><code>data_new = data[:, :, :, 0]
  for i in range(1, data.shape[3]):
      data_new = np.concatenate((data_new, data[:, :, :, i]), axis=1)
  </code></pre>