[SciPy-user] scipy.io.read_array: NaN in data file

Dharhas Pothina Dharhas.Pothina@twdb.state.tx...
Tue Mar 10 11:44:29 CDT 2009


>> so does np.genfromtxtx also deal with missing values in a file?
>Yep:

sweet. This is going to be very useful.

 >>> data = StringIO.StringIO("""#
1999,4,12,
1999,5,,,
1999,6,12,34
""")
> Looks like the first 2 columns are YYYY and MM: you can use  
> scikits.timeseries.tsfromtxt for that, with a special converter to  
> transform the first 2 columns into a datearray:
> dconv=lambda y,m: Date('M', year=y, month=m)

This was just an example I made up. But most of the files I'm reading are in the format :

columns that define date followed by columns of various data

Could you run me through the commands to go from the file containing the data to the timeseries masking missing data in the process?

ie. can StringIO read from a file or do I need to load the data first and then call StringIO and then call tsfromtxt() to reread the file?

thanks ,

- dharhas








More information about the SciPy-user mailing list