Suppose I have a numpy array e constructed as follow:
import numpy as np
a = np.array([1,2])
b = np.array([3,4])
c = np.array([5,6])
d = np.array([7,8])
e = np.empty((2,2), dtype=object)
e[0,0] = a
e[0,1] = b
e[1,0] = c
e[1,1] = d
>>> e
array([[array([1, 2]), array([3, 4])],
[array([5, 6]), array([7, 8])]], dtype=object)
I don't know how to unpack the array e so that it becomes:
array([[1, 2, 3, 4],
[5, 6, 7, 8]])
Any hint is appreciated.
earray in the first place is usually a mistake. Consider changing the code that producese.+.array([1,2] + [3,4])is manipulation oflists notnumpy.ndarrays. It works differently thanarray([1,2]) + array([3,4])