[Numpy-discussion] More loadtxt() changes

Manuel Metz mmetz at astro.uni-bonn.de
Fri Nov 28 05:42:24 EST 2008


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



More information about the NumPy-Discussion mailing list