archivefeed

getting started with scikit.tseries

scikit.timeseries provides classes and functions for manipulating, reporting, and plotting time series.

Installation

Get a virtualenv going. I highly recommend using virtualenvwrapper to set up adhoc virtualenvs.

    $ mkvirtualenv tsdev

Get the source code:

    $ cd 
    $ mkdir src
    $ cd src
    $ svn co http://svn.scipy.org/svn/scikits/trunk/timeseries timeseries
    $ cd timeseries
    $ workon tsdev
    $ python setup.py install 

We will test this installation by running a example code from the project website.

import numpy as np
import matplotlib.pyplot as plt
import scikits.timeseries as ts
import scikits.timeseries.lib.plotlib as tpl
from scikits.timeseries.lib.moving_funcs import mov_average_expw

# generate some random data
data = np.cumprod(1 + np.random.normal(0, 1, 300)/100)
series = ts.time_series(data,
                       start_date=ts.Date(freq='M', year=1982,
                       month=1))
fig = tpl.tsfigure()
fsp = fig.add_tsplot(111)
fsp.tsplot(series, '-', mov_average_expw(series, 40), 'r--')
plt.show()

I’m primarily interested in experimenting with various moving windowin functions