title: Transform numpy array to incorporate inside arrays
body: <p>I have a multidimensional numpy array of dtype object, which was filled with other arrays.
  As an example, here is a code reproducing that behavior:</p>
  <pre><code>arr = np.empty((3,4,2,1), dtype=object)
  for i in range(arr.shape[0]):
      for j in range(arr.shape[1]):
          for k in range(arr.shape[2]):
              for l in range(arr.shape[3]):
                  arr[i, j, k, l] = np.random.random(10)
  </code></pre>
  <p>Since all the inside arrays have the same size, I would like in this example to &quot;incorporate&quot; the last level into the array and make it an array of size (3,4,2,1,10).
  I cannot really change the above code, so what I am looking for is a clean way (few lines, possibly without for loops) to generate this new array once created.</p>
  <p>Thank you.</p>