[SciPy-user] Subclass of TimeSeries

Robert Ferrell ferrell@diablotech....
Wed May 20 18:12:50 CDT 2009

How do I derive a subclass from TimeSeries?  I tried

import scikits.timeseries as ts
import numpy as np

class MyTS(ts.TimeSeries):
	def __init__(self, label, dataArray, dateArray):
		ts.TimeSeries.__init__(self, data=dataArray, dates=dateArray)

A = np.random.random(10)
dts = ts.date_array(start_date = ts.Date('d', '2009-1-1'), length=10,  
myts = MyTS(label='notWork', dataArray=A, dateArray=dts)

But that doesn't work.  In this case, I got:

/Users/Shared/Develop/Sandbox/tsSubClass.py in <module>()
      13 A = np.random.random(10)
      14 dts = ts.date_array(start_date = ts.Date('d', '2009-1-1'),  
length=10, freq='d')
---> 15 myts = MyTS(label='notWork', dataArray=A, dateArray=dts)
      16 print myts.series

<type 'exceptions.TypeError'>: __new__() takes at least 3 non-keyword  
arguments (1 given)

Am I making some silly mistake?  Or is this a bit more complicated  
than I realize?


More information about the SciPy-user mailing list