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

Pierre GM pgmdevlist@gmail....
Thu Apr 3 15:03:13 CDT 2008


On Thursday 03 April 2008 15:41:22 Marco Tuckner wrote:
> But then I just would like to bend this date (29-Feb) out when writing the
> report [timseries.Report(series)]. How would you do that?
> Or would you recommend to reopen the csv-file again afterwards to delete
> the records?

Ah, I'll forward your email to Matt Knox, who wrote the report module. I never 
used it myself... 
But if you need to get rid of masked dates/data for one reason or another, you 
can just use the .compressed() method:

>>>import numpy.ma as ma
>>>import scikits.timeseries as ts
>>>series=ts.time_series(numpy.arange(1,51),
>>>                               start_date=ts.Date('D',string='2000-02-01')) 
>>>series[(series.months==2)&(series.days==29)]=ma.masked
>>>print series.compressed()
[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50]


> P.S. I think that many problems I have using timeseries arise from not
> knowing how maskedarray works. If only the new maskedarry would have been
> that well documented as the time series package [1] I would find my way in
> much easier! Is there any documentation for maskedarray like:
> [1] http://scipy.org/scipy/scikits/wiki/TimeSeries

Nope, and I take full blame for it: I never really had the time nor the 
gumption to write one. I'd be quite grateful if you or any volunteer could 
start one, so that we could all append it as needed.


More information about the SciPy-user mailing list