[Numpy-discussion] More loadtxt() changes

Ryan May rmay31@gmail....
Wed Nov 26 16:55:47 CST 2008

Manuel Metz wrote:
> Ryan May wrote:
>> 3) Better support for missing values.  The docstring mentions a way of
>> handling missing values by passing in a converter.  The problem with this is
>> that you have to pass in a converter for *every column* that will contain
>> missing values.  If you have a text file with 50 columns, writing this
>> dictionary of converters seems like ugly and needless boilerplate.  I'm
>> unsure of how best to pass in both what values indicate missing values and
>> what values to fill in their place.  I'd love suggestions
> Hi Ryan,
>    this would be a great feature to have !!!

Thanks for the support!

> One question: I have a datafile in ASCII format that uses a fixed width 
> for each column. If no data if present, the space is left empty (see 
> second row). What is the default behavior of the StringConverter class 
> in this case? Does it ignore the empty entry by default? If so, what is 
> the value in the array in this case? Is it nan?
> Example file:
>    1| 123.4| -123.4| 00.0
>    2|      |  234.7| 12.2

I don't think this is so much anything to do with StringConverter, but 
more to do with how to split lines.  Maybe we should add an option that, 
instead of simply specifying characters that delimit the fields, allows 
one to pass a custom function to split lines?  That could either be done 
by overriding `delimiter` or by adding a new option like `splitter`

I'll have to give that some thought.


Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

More information about the Numpy-discussion mailing list