[Numpy-discussion] Using numpy's flatten_dtype with structured dtypes that have titles

Pierre GM pgmdevlist at gmail.com
Mon Aug 23 11:09:17 EDT 2010


On Aug 23, 2010, at 10:50 AM, Emma Willemsma wrote:

> I have attached a short script and sample text file that demonstrate the problem. The dtype I'm using in the example is:
> 
> dtype2 = numpy.dtype([(("Amps","Current"),"f8"),(("Volts","Voltage"),"f8"),(("Watts","Power"),"f8")])
> 
> When I run the code as-is, I get the ValueError. If I run it with the monkey patch, it runs as I would expect.
> 
> On the other hand, if I remove the titles from the dtype, the code works with or without the monkey patch. Without the titles, the dtype looks like:
> 
> dtype1 = numpy.dtype([("Current","f8"),("Voltage","f8"),("Power","f8")])
> 
> Thanks very much for your help with this issue.
> 
> Emma

Emma,
Please open a ticket. That's a bug in flatten_dtype, which cannot handle titles in the dtype (as I never used titles, I forgot they were there...). I'll try to take care of that ASAP.


More information about the NumPy-Discussion mailing list