[Numpy-discussion] numpy.genfromtxt converters issue
Thu Nov 11 13:31:03 CST 2010
Pierre GM writes:
> In practice, that's exactly what happens below the hood when
> genfromtxt tries to guess the output type of the converter. It tries a
> single value ('1'), fails, and decides that the result must be an
> object... Probably not the best strategy, as it crashes in your
> case. But yours is a buggy case anyway.
> Now, we can argue over the very last point: if both a converter and a
> dtype are specified, which one should take precedence?
> You have my opinion, let's hear yours.
What about delaying the calculation of converters? Instead of using type
checks with fake data, 'StringConverter.update' could take an optional
argument 'imput_sample' (defaulting to "1") in order to perform its
Then, use real data from the first (non-comment, non-names) line of the
input file when calling 'StringConverter.update' in 'genfromtxt'.
"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
More information about the NumPy-Discussion