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

scipy-svn@scip... scipy-svn@scip...
Tue Aug 14 12:45:28 CDT 2007


Author: mattknox_ca
Date: 2007-08-14 12:45:19 -0500 (Tue, 14 Aug 2007)
New Revision: 3231

Modified:
   trunk/Lib/sandbox/timeseries/tseries.py
Log:
added tolist method

Modified: trunk/Lib/sandbox/timeseries/tseries.py
===================================================================
--- trunk/Lib/sandbox/timeseries/tseries.py	2007-08-14 17:01:55 UTC (rev 3230)
+++ trunk/Lib/sandbox/timeseries/tseries.py	2007-08-14 17:45:19 UTC (rev 3231)
@@ -919,6 +919,17 @@
 TimeSeries.tofile = tofile
 
 #............................................
+def tolist(self, fill_value=None):
+    """Copies the date and data portion of the time series to a hierarchical
+python list and returns that list. Data items are converted to the nearest
+compatible Python type. Dates are converted to standard Python datetime
+objects. Masked values are filled with `fill_value`"""
+    return [(d.datetime, v) for (d,v) in \
+                                zip(self.dates, self._series.tolist())]
+TimeSeries.tolist = tolist
+
+#............................................
+
 def asrecords(series):
     """Returns the masked time series as a recarray.
 Fields are `_dates`, `_data` and _`mask`.



More information about the Scipy-svn mailing list