[SciPy-User] How to concatenate timeseries

Pierre GM pgmdevlist at gmail.com
Mon Jan 4 12:50:34 EST 2010


On Jan 4, 2010, at 12:19 PM, Tim Michelsen wrote:
> What is the best methoth concatenate these to one long running time series?
> 
> I tried:
> 
> 
> import scikits.timeseries as ts
> series = ts.time_series([0,1,2,3], start_date=ts.Date(freq='A', year=2005))
> series1 = ts.time_series([0,1,2,3], start_date=ts.Date(freq='A', year=2009))
> 
> import numpy as np
> full = np.concatenate([series, series1])
> 
> But the full series has then the frequency 'U' for undefined.
> 
> What am I missing?


Use the concatenate function that comes with scikits.timeseries
>>> ts.concatenate([series,series1])
timeseries([0 1 2 3 0 1 2 3],
   dates = [2005 ... 2012],
   freq  = A-DEC)

ts.concatenate tests whether the series have the same frequency, and optional parameters let you decide what to do with duplicates.




More information about the SciPy-User mailing list