Update
From the comments, reshaping array
Initial array shape is (2, 1, 3) as in x but is list of numpy arrays,
We concatenate along outer most axis = 0 of each numpy array, which will merge those numpy array into single. This will remove (2, 1, 3) --> (2, 3)
np.newaxis is to convert the inner numpy array by one more dimension.
>>> from numpy import array, float32
>>> import numpy as np
>>> x = [ array([[ 1.9392334, -2.4614801, 1.1337504]], dtype=float32), array([[-2.705459 , 3.260675 , -0.9435711]], dtype=float32)]
>>> x.shape
>>> np.concatenate(x, axis=0)
array([[ 1.9392334, -2.4614801, 1.1337504],
[-2.705459 , 3.260675 , -0.9435711]], dtype=float32)
>>> y = np.concatenate(x, axis=0)
>>> y.shape
(2, 3)
>>> z = y[np.newaxis, :]
>>> z.shape
(1, 2, 3)
This means the entries in prediction is not of uniform shape.
Re-inspect or share the prediction array's shape and confirm if all of them are same. I was able to create an example for you which gives same error. This should get you started. As you can see first entry shape is (2, 3) while second entry is (1, 3)
>>> pd.DataFrame([np.array([[1.,2.,3.], [1.,3.,4.]], dtype=np.float32), np.array([[2,3.,4.]], dtype=np.float32)])
/home/lol/anaconda3/lib/python3.8/site-packages/pandas/core/internals/construction.py:305: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
values = np.array([convert(v) for v in values])
0
0 [[1.0, 2.0, 3.0], [1.0, 3.0, 4.0]]
1 [[2.0, 3.0, 4.0]]
Also the errors will not stop there since it is indirectly a 3-d array. Depending on how you want dataframe How to transform a 3d arrays into a dataframe in python will be helpful