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:
['0\t\t4.000000000000000e+007,0.000000000000000e+000\n',
'\t9.860280631554179e-001,-1.902586503306264e-002\n',
'\t9.860280631554179e-001,-1.902586503306264e-002']
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
modify.
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?
Thanks,
Ralf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100226/68b20d3e/attachment.html