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

Fernando Perez fperez.net@gmail....
Wed May 27 17:15:57 CDT 2009


Hi Pierre,

On Wed, May 27, 2009 at 3:01 PM, Pierre GM <pgmdevlist@gmail.com> wrote:
> Have you tried np.lib.io.genfromtxt ?
>

I didn't know about it, but it has the same problem as loadtxt:

In [5]: rdata.block[0,1]  # incorrect
Out[5]: array([1, 1, 1])

In [6]: alt_data.block[0,1]  # same thing, still wrong
Out[6]: array([1, 1, 1])

In [7]: rdata2.block[0,1]   # with my manual workaround, this is right
Out[7]: array([4, 5, 6])

The data is:

# name  x       y       block - 2x3 ints
aaaa	1.0	8.0	1 2 3 4 5 6
...

so only rdata2 is correct, the others are repeating the first '1'
throughout the entire block, which is the problem.

Cheers,

f


More information about the Numpy-discussion mailing list