def save_timeseries(self, obj): import scikits.timeseries.tseries as ts func, reduce_args, state = obj.__reduce__() if func != ts._tsreconstruct: raise pickle.PicklingError('timeseries using unexpected reconstruction function %s' % str(func)) state = (1, obj.shape, obj.dtype, obj.flags.fnc, obj._data.tostring(), ts.getmaskarray(obj).tostring(), obj._fill_value, obj._dates.shape, obj._dates.__array__().tostring(), obj._dates.dtype, #added -- preserve type obj.freq, obj._optinfo, ) return self.save_reduce(_genTimeSeries, (reduce_args, state))