I have a numpy a = np.load('test.npy') file with these nested numpy array:
In [21]: a.shape
Out[21]: (6886, 3)
In [22]: a[0].shape
Out[22]: (3,)
In [23]: a[0][0].shape
Out[23]: (787, 6)
Is there a simple way to change a to be a 4 dimensional array with shape: (6886, 3, 787, 6)?
a.dtypeisobject. Are you sure all elements have the same shape (787,6)? If not the task is impossible. If they do, you can usenp.stack(but have to first reshape the outer array).np.nanvalues for arrays that are short: e.g. (506,6) so that they all become same shape: (787,6)?