[Numpy-discussion] numpy.genfromtxt converters issue

Lluís xscript@gmx....
Mon Nov 15 06:07:58 CST 2010


Pierre GM writes:

> On Nov 14, 2010, at 9:30 PM, Lluís wrote:

>> This will work as long as 'first_values' is assured to always contain
>> valid data and as long as its indexes are equivalent to those in
>> converters (which I simply haven't checked).

> I beat you to it, actually ;)

Argh! :)


> Check the git push I committed earlier today. I followed exactly the
> same approach as yours (well, almost: I do check whether the first
> line is empty (there were names) and then fall back on the default
> testing value ('1')...

Just out of curiosity... why do you check for the length of
'first_line'? Now I've looked into the code, and it seems that
'first_values' will always contain valid contents:
  https://github.com/numpy/numpy/blob/de4de92be21e4dda3665648ad5102b3729d4e0b0/numpy/lib/npyio.py#L1209

Lluis

-- 
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth


More information about the NumPy-Discussion mailing list