[SciPy-user] efficiently importing ascii data

Darren Dale dd55 at cornell.edu
Sun Nov 13 23:31:28 EST 2005


On Sunday 13 November 2005 10:46 pm, you wrote:
> Darren Dale wrote:
> >I am considering using scipy's fromfile function, which gives a big speed
> >boost over io.read_array, but I don't understand what this docstring is
> >trying to tell me:
> >
> >    WARNING: This function should be used sparingly, as it is not
> >    a robust method of persistence.  But it can be useful to
> >    read in simply-formatted or binary data quickly.
>
> It's simply trying to advertise that fromfile and tofile are very raw
> functions.   They should work fine as far as they go, but there may be
> easier solutions.  I don't expect the capability of these to increase.
> But, for example, something like a TableIO could take advantage of them.

I was wondering if the fromstring function could be expanded to include ascii 
strings. Right now, I'm considering reading my messy file, creating a neatly 
formatted string, writing that string back into a temporary file, and then 
using the fromfile function. It would be so much nicer to just create the 
array from the string itself.

Darren




More information about the SciPy-User mailing list