[Numpy-discussion] Properties of fields in numpy

Travis Oliphant oliphant at ee.byu.edu
Mon Feb 6 11:21:01 EST 2006


Francesc Altet wrote:

>Hi,
>
>I don't specially like the 'void*' typecasting that are receiving the
>types in fields in situations like:
>
>In [143]:dtype = numpy.dtype([
>   .....:    ('x', '<i4', (2,)),
>   .....:    ('Info',[
>   .....:        ('name', '<U120'),
>   .....:        ('weight', '<f4')])])
>
>In [147]:dtype.fields['x'][0].name
>Out[147]:'void64'
>
>were you can see that we have lost the information about the native type
>of the 'x' field. Rather, I'd expect something like:
>  
>
Well, it's actually there.   Look at

dtype.fields['x'][0].subdtype[0]
dtype.fields['x'][0].subdtype[1]

The issue is that the base data-type of the 'x' field is void-64 (that's 
the dtype object the array "sees"). 

-Travis









More information about the NumPy-Discussion mailing list