[Scipy-svn] r2626 - trunk/Lib/sandbox/timeseries

scipy-svn at scipy.org scipy-svn at scipy.org
Mon Jan 29 09:14:08 CST 2007


Author: mattknox_ca
Date: 2007-01-29 09:14:04 -0600 (Mon, 29 Jan 2007)
New Revision: 2626

Modified:
   trunk/Lib/sandbox/timeseries/tseries.py
Log:
modified align_series so that it can handle series of size zero

Modified: trunk/Lib/sandbox/timeseries/tseries.py
===================================================================
--- trunk/Lib/sandbox/timeseries/tseries.py	2007-01-29 14:57:50 UTC (rev 2625)
+++ trunk/Lib/sandbox/timeseries/tseries.py	2007-01-29 15:14:04 UTC (rev 2626)
@@ -1064,15 +1064,17 @@
     if common_freq == 'U':
         raise TimeSeriesError, \
             "Cannot adjust a series with 'Undefined' frequency."
-    valid_states = [x.isvalid() for x in series]
+    valid_states = [x.isvalid() or (x.size == 0 and x.ndim > 0) for x in series]
     if not numpy.all(valid_states):
         raise TimeSeriesError, \
             "Cannot adjust a series with missing or duplicated dates."
     
-    start_date = kwargs.pop('start_date', min([x.start_date for x in series]))
+    start_date = kwargs.pop('start_date', min([x.start_date for x in series if x.start_date is not None]))
+    print start_date
     if isinstance(start_date,str):
         start_date = Date(common_freq, string=start_date)
-    end_date = kwargs.pop('end_date', max([x.end_date for x in series]))
+    end_date = kwargs.pop('end_date', max([x.end_date for x in series if x.end_date is not None]))
+    print end_date
     if isinstance(end_date,str):
         end_date = Date(common_freq, string=end_date)
     



More information about the Scipy-svn mailing list