[Numpy-discussion] Reading data from structured text

klo uo klonuo at gmail.com
Sat Jun 15 06:47:00 EDT 2013


Hi,

I have data reports in text files, where first 5 lines describe the
data following, which is actually continuous time series of 2048
values wrapped in 205 rows and 10 columns, and each file has 12 such
sets.

If I crop to first dataset and leave the headers (first 5 lines),
genfromtxt(skip_header=5) raises ValueError because last row contains
8 records instead 10 like the rest.

If I just try to read file as is, with same argument,
genfromtxt(skip_header=5), I get many errors as genfromtxt() doesn't
seem to be able to detect header present on every dataset.

So can I read such file with numpy and learn for future use, or should
I just write my reader?



More information about the NumPy-Discussion mailing list