Numpy object array of numerical arrays
I can't find any elegant solution, but at least a more general solution to doing everything by hand is to declare a function of the form:
def object_array(*args): array = np.empty(len(args), dtype=np.object) for i in range(len(args)): array[i] = args[i] return array
I can then do:
a = np.array([1,2,3])b = object_array(a,a,a)
I then get:
>>> a = np.array([1,2,3])>>> b = object_array(a,a,a)>>> print b.dtypeobject>>> print b.shape(3,)>>> print b[0].dtypeint64