[Numpy-discussion] Properties of fields in numpy
oliphant at ee.byu.edu
Mon Feb 6 16:09:02 EST 2006
Francesc Altet wrote:
>I don't specially like the 'void*' typecasting that are receiving the
>types in fields in situations like:
>In :dtype = numpy.dtype([
> .....: ('x', '<i4', (2,)),
> .....: ('Info',[
> .....: ('name', '<U120'),
> .....: ('weight', '<f4')])])
>were you can see that we have lost the information about the native type
>of the 'x' field. Rather, I'd expect something like:
In SVN of numpy, the dtype objects now have a .base attribute and a
The .shape attribute returns (1,) or the shape of the sub-array.
The .base attribute returns the data-type object of the base-type, or a
new reference to self, if the object has no base.type.
Thus, in current SVN
dtype['x'].base.name would always give you what you want.
More information about the NumPy-Discussion