I was wondering if it is possible to have a numpy.array as a datatype in a structured array. This is the idea:
import numpy
raw_data = [(1, numpy.array([1,2,3])),
(2, numpy.array([4,5,6])),
(3, numpy.array([7,8,9]))]
data = numpy.array(raw_data, dtype=[('num', float),
('arr', numpy.array)])
I have a list of tuples consisting of an integer and an array and would like to turn this into a structured array. Right now, Python complains that it does not understand the 'numpy.array' datatype. Is there another way to refer to the array datatype?
The motivation behind is to be able to do things like:
print numpy.min(data['arr'], axis=0)
print numpy.min(data['arr'], axis=1)
and other operations.