[Numpy-discussion] using loadtxt() for given number of rows?
Stéfan van der Walt
Mon Feb 14 10:28:34 CST 2011
On Mon, Jan 31, 2011 at 2:39 PM, Robert Cimrman <firstname.lastname@example.org> 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.
More information about the NumPy-Discussion