How to concatenate timeseries

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to concatenate timeseries

Timmie
Administrator
Hello,
I am reading timeseries data from different files covering various successive
time intervals.

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?

Thanks,
Timmie

_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: How to concatenate timeseries

Pierre GM-2
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.

_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: How to concatenate timeseries

Timmie
Administrator
> 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.
Must have overlooked that.
But it isn't in the docs either:
http://pytseries.sourceforge.net/search.html?q=concatenate

_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user