[Scipy-svn] r2400 - trunk/Lib/sandbox/timeseries/examples
scipy-svn at scipy.org
scipy-svn at scipy.org
Tue Dec 12 14:10:21 EST 2006
Author: mattknox_ca
Date: 2006-12-12 13:10:16 -0600 (Tue, 12 Dec 2006)
New Revision: 2400
Modified:
trunk/Lib/sandbox/timeseries/examples/example.py
Log:
ts.where usage was redundant in the examples
Modified: trunk/Lib/sandbox/timeseries/examples/example.py
===================================================================
--- trunk/Lib/sandbox/timeseries/examples/example.py 2006-12-12 13:13:53 UTC (rev 2399)
+++ trunk/Lib/sandbox/timeseries/examples/example.py 2006-12-12 19:10:16 UTC (rev 2400)
@@ -6,19 +6,13 @@
bSer = ts.TimeSeries(np.random.uniform(-100,100,600),dtype=np.float64,freq='B',observed='SUMMED',startIndex=ts.thisday('B')-600)
-"""
-Set negative values to zero. Note that ts.where returns a TimeSeries object.
-Indexing by booleans can only be done with TimeSeries objects of the same
-frequency.
-"""
-bSer[ts.where(bSer < 0,True,False)] = 0
+# Set negative values to zero.
+bSer[bSer < 0] = 0
-"""
-Set values occurring on Fridays to 100.
-"""
+# Set values occurring on Fridays to 100.
weekdays = ts.day_of_week(ts.tser(bSer.firstValue(asDate=True),bSer.lastValue(asDate=True)))
-bSer[ts.where(weekdays == 4,True,False)] = 100
+bSer[weekdays == 4] = 100
"""
More information about the Scipy-svn
mailing list