[Numpy-discussion] np.loadtxt : yet a new implementation...

Stéfan van der Walt stefan@sun.ac...
Mon Dec 1 15:47:00 CST 2008

2008/12/1 Ryan May <rmay31@gmail.com>:
> I've wondered about this being an issue.  On one hand, you hate to make
> existing code noticeably slower.  On the other hand, if speed is
> important to you, why are you using ascii I/O?

More "I" than "O"!  But I think numpy.fromfile, once fixed up, could
fill this niche nicely.

> I personally am not entirely against having two versions of loadtxt-like
> functions.  However, the idea seems a little odd, seeing as how loadtxt
> was already supposed to be the "swiss army knife" of text reading.

I haven't investigated the code in too much detail, but wouldn't it be
possible to implement the current set of functionality in a
base-class, which is then specialised to add the rest?  That way, one
could always instantiate TextReader yourself for some added speed.

> I'm not really opinionated on what the right approach is here.  My only
> opinion is that this functionality *really* needs to be in numpy in some
> fashion.  For my own use case, with the old version, I could read a text
> file and by hand separate out columns and mask values.  Now, I open a
> file and get a structured array with an automatically detected dtype
> (names and types!) plus masked values.

That's neat!


More information about the Numpy-discussion mailing list