[SciPy-dev] time series implementation approach
Pierre GM
pgmdevlist at gmail.com
Tue Dec 12 14:57:00 CST 2006
Folks,
I promised Matt I would whine about the descriptions ;)
Implementation A (MaskedArrays):
* Slicing remains natural: should you need the last 10 values, regardless of
the date, just use [-10:], which will output the values and update the
corresponding starting date.
* A call to foo[2] really returns the third value, regardless of the starting
point.
* Adding 2 series is only possible if the series have the same frequency and
the same starting date. So something like foo = series1[5:25] + series2[5:25]
still make sense. Aligning series (viz, setting the same starting and ending
points) is done with a simple function.
* Fine if you're more interested in the data than the dates.
implementation B (ShiftingArrays):
* Slicing is trickier: should you need the last 10 values, regardless of the
date, you need to find the index of the latest valid value, and count 10
backwards. Too bad if the latest value was masked.
* A call to foo[3] returns the third element of the dynamic array, which may
fall before the series actually starts.
* Things get really simple and fast once you've learned to think in terms of
dynamic arrays, as long as you don't lose track of the starting point.
* Ideal if you're more interested in the dates than the values.
Note that in any case, we suppose that the series are regularly spaced, but we
can work on that. The code relies strongly on mx.DateTime. Part of the dirty
work is done in C (for switching from one frequency to another especially).
More information about the Scipy-dev
mailing list