[Numpy-discussion] Question about improving genfromtxt errors

Christopher Barker Chris.Barker at noaa.gov
Tue Sep 29 15:28:26 EDT 2009


Pierre GM wrote:
>> Another idea: only store the indexes of the rows that have the "wrong"
>> number of columns -- if that's a large number, then then user has  
>> bigger
>> problems than memory usage!
> 
> That was my first idea, but then it adds tests in the inside loop  
> (which is what I'm trying to avoid)...

well, how does one test compare to:

read the line from the file
split the line into tokens
parse each token

I can't imagine it's significant, but I guess  you only know with profiling.

How does it handle the wrong number of tokens now? if an exception is 
raised somewhere, then that's the only place you'd need to anything 
extra anyway.

> OK, I should be able to start working on that in the next few days.

cool!

-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

Chris.Barker at noaa.gov



More information about the NumPy-Discussion mailing list