[Numpy-discussion] dtype.type for structured arrays

Thomas Robitaille thomas.robitaille@gmail....
Sat Jul 24 14:42:21 CDT 2010


Hi,

If I create a structured array with vector columns:

>>> array = np.array(zip([[1,2],[1,2],[1,3]]),dtype=[('a',float,2)])

then examine the type of the column, I get:

>>> array.dtype[0]
dtype(('float64',(2,)))

Then, if I try and view the numerical type, I see:

>>> array.dtype[0].type
<type 'numpy.void'>

I have to basically do

>>> array.dtype[0].subdtype[0]
dtype('float64')

to get what I need. I seem to remember that this used not to be the case, and that even for vector columns, one could access array.dtype[0].type to get the numerical type. Is this a bug, or deliberate?

Thanks,

Thomas


More information about the NumPy-Discussion mailing list