Setup
a
Out[46]:
array([[array([5, 5, 4, 2]), array([1, 5, 1, 3]), array([3, 2, 8, 5])],
[array([3, 5, 7, 3]), array([3, 1, 3, 4]), array([5, 2, 6, 7])]], dtype=object)
a.shape
Out[47]: (2L, 3L)
a[0,0].shape
Out[48]: (4L,)
Solution
#convert each element of a to a list and then reconstruct a 3D array in desired shape.
c = np.array([e.tolist() for e in a.flatten()]).reshape(a.shape[0],a.shape[1],-1)
c
Out[68]:
array([[[5, 5, 4, 2],
[1, 5, 1, 3],
[3, 2, 8, 5]],
[[3, 5, 7, 3],
[3, 1, 3, 4],
[5, 2, 6, 7]]])
c.shape
Out[69]: (2L, 3L, 4L)
A.dtype? What'sA[0,0].dtype?