[Scipy-svn] r2775 - trunk/Lib/sandbox/timeseries
scipy-svn at scipy.org
scipy-svn at scipy.org
Wed Feb 28 09:04:20 EST 2007
Author: mattknox_ca
Date: 2007-02-28 08:04:16 -0600 (Wed, 28 Feb 2007)
New Revision: 2775
Modified:
trunk/Lib/sandbox/timeseries/reportlib.py
Log:
added ability to handle series that have missing dates
Modified: trunk/Lib/sandbox/timeseries/reportlib.py
===================================================================
--- trunk/Lib/sandbox/timeseries/reportlib.py 2007-02-27 21:45:40 UTC (rev 2774)
+++ trunk/Lib/sandbox/timeseries/reportlib.py 2007-02-28 14:04:16 UTC (rev 2775)
@@ -60,6 +60,7 @@
import sys
import operator, types, copy
import timeseries as ts
+import maskedarray as ma
__all__ = [
'Report', 'wrap_onspace', 'wrap_onspace_strict',
@@ -359,20 +360,12 @@
else:
col_width = [col_width for x in range(len(tseries)+1)]
- ############################################################
- # temporary hack to handle singletons for different types of
- # behaviour until we finalize how they will be handled
- ############################################################
- if ts.time_series([1,2], start_date=ts.thisday('b'))[0].ndim == 0:
- def getval(series, date): return series[date]
- else:
- def getval(series, date):
- temp = series[date]
- if temp is ts.tsmasked:
- return temp
- else:
- return temp.series[0]
- ############################################################
+ def getval(series, date):
+ try:
+ val = series[date]
+ except IndexError:
+ val = ma.masked
+ return val
for d in dates:
rows.append([datefmt_func(d)]+[fmtfunc[i](getval(ser, d)) for i, ser in enumerate(tseries)])
More information about the Scipy-svn
mailing list