[SciPy-user] scikits.timeseries: tsfromtxt

Pierre GM pgmdevlist@gmail....
Wed Jan 14 19:18:54 CST 2009

It works on my machine: you do end up with a series with a structured  
dtype [('f1',int)], and the date is correctly processed...

 >>> import StringIO
 >>> data="""datetime;test
... 01.01.07 00:00; 10
... 01.01.07 01:00; 15
 >>> ts.tsfromtxt(StringIO.StringIO(data), delimiter=';', skiprows=1,  
datecols=0, freq='H')
timeseries([(10,) (15,)],
    dtype = [('f1', '<i4')],
    dates = [01-Jan-2007 00:00 01-Jan-2007 01:00],
    freq  = H)

You can then take a view of the result as int to get a series without  
named fields.

It looks like you're using an old version of numpy (older than mine  
anyway...): which one is it ?
FYI, I only tested the module on 1.3.x (the SVN version). 1.3.0 will  
be a requirement as soon as it is released anyway.
Explanation: there's been a significant effort to improve support of  
structured/flexible dtype arrays in numpy.ma between 1.2 and 1.3. The  
code underlying tsfromtxt is based on these modifications. I can't/ 
won't backport the modifications from 1.3.0dev to 1.2.2. I could try  
to put some of the modifications to numpy.ma in the _preview.py file  
of the package, but that'd be just a hack. It's far easier to require  
1.3 only.

More information about the SciPy-user mailing list