[SciPy-user] scipy.io.read_array: NaN in data file
Tue Mar 10 11:54:52 CDT 2009
On Mar 10, 2009, at 12:44 PM, Dharhas Pothina wrote:
>>> so does np.genfromtxtx also deal with missing values in a file?
> sweet. This is going to be very useful.
That was the whole aim of the game ;)
> 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
ts.tsfromtxt is just a tailored version of np.genfromtxt. The input
can be a filename ("data.txt"), a file (gzip version supported), or a
string content (a la StringIO). Just use datecols to precise what
column should be interpreted as date, your delimiter, any specific
string representing a missing data (eg, "NaN". By default, '' is
recognized), any additional converter... Just check the docstrings of
ts.tsfromtxt and np.genfromtxt for more info, and let us know how we
can improve them.
More information about the SciPy-user