[Numpy-discussion] Bug in genfromtxt with usecols and converters
adrian.altenhoff at inf.ethz.ch
Tue Aug 26 12:21:30 EDT 2014
thanks for your answer.
> not sure whether to call it a bug; the error seems to arise before reading any actual data
> (even on reading from an empty string); when genfromtxt is checking the filling_values used
> to substitute missing or invalid data it is apparently testing on default testing values of 1 or -1
> which your conversion scheme does not know about. Although I think it is rather the user’s
> responsibility to provide valid converters, probably the documentation should at least be
> updated to make them aware of this requirement.
> I see two possible fixes/workarounds:
> provide an keyword argument filling_values=[0,0,'1:1’]
This workaround seems to be work, but I doubt that the actual problem is
the converter function I pass. The '-1', which is used as the testing
value is the first_values from the 3rd column (line 1574 in npyio.py),
but the converter is defined for column 4. by setting the filling_values
to an array of length 3, this obviously makes the problem disappear. But
I think if the first row is used, it should also use the values from the
column for which the converter is defined.
More information about the NumPy-Discussion