[Numpy-discussion] np.loadtxt : yet a new implementation...

Pierre GM pgmdevlist@gmail....
Mon Dec 1 11:49:01 CST 2008


All,

Please find attached to this message another implementation of  
np.loadtxt, which focuses on missing values. It's basically a  
combination of John Hunter's et al mlab.csv2rec, Ryan May's patches  
and pieces of code I'd been working on over the last few weeks.
Besides some helper classes (StringConverter to convert a string into  
something else, NameValidator to check names..._), you'll find 3  
functions:

* `genloadtxt` is the base function that makes all the work. It  
outputs 2 arrays, one for the data (missing values being substituted  
by the appropriate default) and one for the mask. It would go in  
np.lib.io

* `loadtxt` would replace the current np.loadtxt. It outputs a  
ndarray, where missing data being filled. It would also go in np.lib.io

* `mloadtxt` would go into np.ma.io (to be created) and renamed  
`loadtxt`. Right now, I needed a different name to avoid conflicts. It  
combines the outputs of `genloadtxt` into a single masked array.

You'll also several series of tests, that you can use as examples.

Please give it a try and send me some feedback (bugs, wishes,  
suggestions). I'd like it to make the 1.3.0 release (I need some of  
the functionalities to improve the corresponding function in  
scikits.timeseries, currently fubar...)

P.



More information about the Numpy-discussion mailing list