title: Stacking numpy arrays with padding
body: <p>I have a list of 32 numpy arrays, each of which has shape <code>(n, 108, 108, 2)</code>, where <code>n</code> is different in each array. I want to stack all of them to create a numpy array of shape <code>(32, m, 108, 108, 2)</code>, where <code>m</code> is the maximum among the <code>n</code>s, and the shorter arrays are padded with zeros.</p>
  
  <p>How do I do this?</p>
  
  <p>I asked <a href="https://stackoverflow.com/questions/53051560/stacking-numpy-arrays-of-different-length-using-padding/53052599?noredirect=1#comment93005810_53052599">something similar</a> yesterday, but the answers there seem to break when using deep arrays like in my case.</p>
  
  <p>Concretely, I went with this solution in the end, which produced the cleanest code:</p>
  
  <pre><code>data = np.column_stack(zip_longest(*data, fillvalue=0))
  </code></pre>
  
  <p>But now it is throwing this error:</p>
  
  <pre><code>ValueError: setting an array element with a sequence.
  </code></pre>