[SciPy-user] removing certain dates from a time series

Pierre GM pgmdevlist at gmail.com
Tue Apr 1 17:51:17 EDT 2008


Marco,

> How to I remove the february 29 from my timeseries without affecting the
> dates after?

Don't remove the dates, just mask the corresponding data, as illustrated in 
the following

>>>import numpy
>>>from numpy.ma import masked
>>>import scikits.timeseries as ts
>>>series=ts.time_series(numpy.arange(3650),start_date=ts.now('D'))
>>>series[(series.days==29)&(series.months==2)]=ma.masked

As long as your analysis functions deal w/ masked values in a nice way, you're 
set (for example, mean/sum/var all work well with masked values).
HIH
P.



More information about the SciPy-User mailing list