[Numpy-discussion] odd ascii format and genfromtxt

Ralf Gommers ralf.gommers@googlemail....
Fri Feb 26 00:50:54 CST 2010

Hi all,

I'm trying to read in data from text files with genfromtxt, and have some
trouble figuring out the right combination of keywords. The format is:


Note that there are two delimiters, tab and comma. Also, the first line has
an extra integer plus tab (this is a repeating pattern). The files are
large, there's a lot of them, and they're generated by a binary I can't

Here are some things I've tried:

In [216]: np.genfromtxt('ascii2test.raw', invalid_raise=False)
Out[216]: array([  0.,  NaN])

In [217]: np.genfromtxt('ascii2test.raw', invalid_raise=False,
delimiter=['\t', ','])
TypeError: cannot perform accumulate with flexible type

In [228]: np.genfromtxt('ascii2test.raw', delimiter=['\t', ','],
dtype=[('intvar', '<i8'), ('fltvar', '<f8'), ('fltvar2', '<f8')])
TypeError: cannot perform accumulate with flexible type

Any suggestions?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100226/68b20d3e/attachment.html 

More information about the NumPy-Discussion mailing list