[Numpy-discussion] More loadtxt() changes

Pierre GM pgmdevlist at gmail.com
Fri Nov 28 14:07:40 EST 2008


Manuel,

Give me the week-end to come up with something. What you want is  
already doable with the current implementation of np.loadtxt, through  
the converter keyword. Support for missing data will be covered in a  
separate function, most likely to be put in numpy.ma.io at term.



On Nov 28, 2008, at 5:42 AM, Manuel Metz wrote:

> Pierre GM wrote:
>> On Nov 27, 2008, at 3:08 AM, Manuel Metz wrote:
>>> Certainly, yes! Dealing with fixed-length fields would be necessary.
>>> The
>>> case I had in mind had both -- a separator ("|") __and__ fixed- 
>>> length
>>> fields -- and is probably very special in that sense. But such
>>> data-files exists out there...
>>
>> Well, if you have a non-space delimiter, it doesn't matter if the
>> fields have a fixed length or not, does it? Each field is stripped
>> anyway.
>
> Yes. It would already be _very_ helpful (without changing loadtxt too
> much) if the current implementation uses a converter like this
>
> def fval(val):
>     try:
>         return float(val)
>     except:
>         return numpy.nan
>
> instead of float(val) by default.
>
> mm
>
>> The real issue is when the delimiter is ' '... I should be able to
>> take care of that over the week-end (which started earlier today over
>> here :)
>> _______________________________________________
>> Numpy-discussion mailing list
>> Numpy-discussion at scipy.org
>> http://projects.scipy.org/mailman/listinfo/numpy-discussion
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion




More information about the NumPy-Discussion mailing list