# [SciPy-dev] time series implementation approach

David Huard david.huard at gmail.com
Wed Dec 13 12:11:30 CST 2006

```Hi Matt,

I don't know how difficult that would be to implement but something like
this would be very useful:

monthlyAverageSeries = myDailyData.convert(freq='MONTHLY', apply='var')

where apply can be any array method. In my case, where I have to compute
aggregated data, monthly sums of daily values, i'd just do

monthlySeries = myDailyData.convert(freq='MONTHLY', apply='sum')
et voila !

And it would spare you the job to code those functions. A lazy
implementation could be to make a callback to python, but I'm pretty sure
Travis has something in the API that would allow this directly from the C
code (PyUFunc_O_O_method ?)

Cheers,

David

monthlyAverageSeries = myDaiyData.convert
> (freq='MONTHLY',observed='AVERAGED')
>
> print monthlyAverageSeries
> ========================
>
> Computing monthly variance can not be done easily at the moment. The
> frequency conversion code is implemented in C and the method of conversion
> is applied at the same time in one step (averaged in this example).  Pierre
> made a good suggestion that I am going to look at doing shortly, which is to
> just group the data in C and return a 2 dimensional array to python, and
> then in python apply a user specified function along the axis. It will be
> slower than doing the whole thing in C, but I think the flexibility is worth
> the trade off. This would make it very easy to compute monthly variance if
> that is what you were after.
>
> As far as irregularily spaced data goes... I think Pierre's suggestion of
> a "nofreq" frequency would work pretty well. It should be fairly easy to
> support that special case, and also support converting it to a more rigid
> frequency.
>
> I'm still wavering on the ShiftingArray vs sub-classing MaskedArray
> approach as the backbone of the TimeSeries object. At this moment I think I
> am leaning more towards sub-classing MaskedArray (bet you didn't expect
> that, Pierre!), but who knows what I will feel like this afternoon.
>
> - Matt
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-dev/attachments/20061213/ab2b45da/attachment.html
```