title: Convert numpy array with many dimensions into 2D array with nested numpy arrays
body: <p>I would like to convert an array with many dimensions (more than 2) into a 2D array where other dimensions would be converted to nested stand-alone arrays.</p>
  
  <p>So if I have an array like <code>numpy.arange(3 * 4 * 5 * 5 * 5).reshape((3, 4, 5, 5, 5))</code>, I would like to convert it to an array of shape <code>(3, 4)</code>, where each element would be an array of shape <code>(5, 5, 5)</code>. The dtype of the outer array would be <code>object</code>.</p>
  
  <p>For example, for <code>np.arange(8).reshape((1, 1, 2, 2, 2))</code>, the output would be equivalent to:</p>
  
  <pre><code>a = np.ndarray(shape=(1,1), dtype=object)
  a[0, 0] = np.arange(8).reshape((1, 1, 2, 2, 2))[0, 0, :, :, :]
  </code></pre>
  
  <p>How can I do this efficiently?</p>