Peter Schmidtke wrote:
> Have you tried the numpy.fromfile function?

good point -- fromfile() can be much faster for the simple cases it can 
handle.

 > not all lines ave the same lenght (not the
> same number of values).
> 
> What would be the best way to load this?

That depends on what the data mean. Is it a 2-d array with missing 
values? If so, how do you know which are missing? Are there the same 
number of tabs in each row? If do than loadtxt should be able to handle it.

You may be best off looping through the file:

for line in file:
   a = numpy.fromstring(line, sep='\t', dtype=np.float)

and do what makes sense with each line.

-Chris









-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[email protected]
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to