[Numpy-discussion] Nested recarrays with subarrays and loadtxt: a bug in loadtxt?

Stéfan van der Walt stefan@sun.ac...
Wed May 27 17:57:12 CDT 2009


Hi Fernando

2009/5/27 Fernando Perez <fperez.net@gmail.com>:
> I'm wondering if the code below illustrates a bug in loadtxt, or just
> a 'live with it' limitation.

I'm not sure whether this is a bug or not.

By specifying the dtype

> dt = dtype(dict(names=['name','x','y','block'],
>                formats=['S4',float,float,(int,(2,3))]))

you are saying "column four contains 6 integers", which is a bit of a
strange notion.  If you want this to be interpreted as "the last 6
columns should be stored in block", then a simple modification to
flatten_dtype should do the trick.

Cheers
Stéfan


More information about the Numpy-discussion mailing list