On Mon, 14 Feb 2011, Stéfan van der Walt wrote:

Hi Robert

On Mon, Jan 31, 2011 at 2:39 PM, Robert Cimrman <cimrm...@ntc.zcu.cz> wrote:
It seems to me, that an additional parameter to loadtxt(), say "nrows" or
"numrows", would do the job, so that the function does not try reading the
entire file. Another possibility would be to raise an exception as it
is now, but also to return the data succesfully read so far.

You can always read chunks of the file into StringIO objects, and pass
those into loadtxt.  I think your request makes sense though, given
that a person can already skip lines at the top of the file.

Thanks for the tip, Stéfan!

I have solved my problem by using np.fromfile(), as suggested by Chris Barker, because I know the number of items to read in advance.

I also think that functionality suitable for loadtxt(), so I created the NumPy ticket 1731.

r.
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to