[Numpy-discussion] numpy.genfromtxt converters issue

Pierre GM pgmdevlist@gmail....
Thu Nov 11 13:35:34 CST 2010


On Nov 11, 2010, at 8:31 PM, Lluís wrote:

> 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
> checks.
> 
> Then, use real data from the first (non-comment, non-names) line of the
> input file when calling 'StringConverter.update' in 'genfromtxt'.

Mmh. That's an idea... Do you have a patch to suggest?


More information about the NumPy-Discussion mailing list