[SciPy-user] scikits.timeseries : how would I plot (orcalculate) monthly statistics.

Dharhas Pothina Dharhas.Pothina@twdb.state.tx...
Wed Mar 4 15:26:36 CST 2009


Original data is on an approximately two week frequency. I'll be reading them in as daily values and converting to monthly.

I eventually want to calculate plot monthly values in a particular year vs mean monthly values for all years (ie vs mean for each month irrespective of year)

I'll try playing around with the what you and Tim have mentioned. but I'm a bit confused about how some of this works.

> If you have a monthly frequency: just use .convert('A') and compute  
> the stats for each column.

Wouldn't this convert it to an Annual frequency, ie one value per year?

> The generic idea is indeed to first convert to monthly. You end up  
> with a (12*n, 31) series that you have to reshape

I get the 12*n , ie 12 months * number of years. Where does the 31 come from. Does the series still contain the daily values after conversion to monthly?

thanks,

- dharhas

>>> Pierre GM <pgmdevlist@gmail.com> 3/4/2009 2:38 PM >>>

On Mar 4, 2009, at 11:15 AM, Dharhas Pothina wrote:
>
> Given 10-15 years of timeseries data

What frequency ? Monthly ? Daily ?

>
> I know how to read in my timeseries and convert it to a monthly  
> frequency but I'm not sure the best way to proceed from here. I  
> guess one way would be to reshape the monthly timeseries array into  
> 12 columns and then calculate the stats on each column but I was  
> wondering if there was a more appropriate method to do this?

* If you have a monhtly frequency: just use .convert('A') and compute  
the stats for each column.

* If you have a daily frequency:
well, I'm afraid you didn't give enough information: what do you want  
for each month, what is the expected shape of the output ? Statistics  
far all the years (eg, the mean for January irrespectively of the  
year), with an output of shape (12,) ? For each year, with an output  
of shape (n, 12) and n the nb of years?
The generic idea is indeed to first convert to monthly. You end up  
with a (12*n, 31) series that you have to reshape. However, because  
you won't need the dates, I strongly advise you to work only on  
the .series part for the reshaping.


> On another note: shouldn't there be a link on this page (http://scikits.appspot.com/timeseries 
> ) to the timeseries home page http://pytseries.sourceforge.net/  .  
> The link on the appspot page (http://pypi.python.org/pypi/scikits.timeseries 
> ) doesn't work.

Thanks for reporting. We were already aware of the problem, that shall  
be fixed when timeseries will be officially released (and then, we'll  
be able to put it on pypi).
_______________________________________________
SciPy-user mailing list
SciPy-user@scipy.org 
http://projects.scipy.org/mailman/listinfo/scipy-user



More information about the SciPy-user mailing list