Skip to content

Commit 7aba1ca

Browse files
committed
DOC: error in cookbook.rst
1 parent 13f659f commit 7aba1ca

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

doc/source/cookbook.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -726,9 +726,10 @@ Rolling Apply to multiple columns where function returns a Scalar (Volume Weight
726726
'Close' : np.random.randn(len(rng)),
727727
'Volume' : np.random.randint(100,2000,len(rng))}, index=rng); df
728728
729-
def vwap(bars): return ((bars.Close*bars.Volume).sum()/bars.Volume.sum()).round(2)
729+
def vwap(bars): return ((bars.Close*bars.Volume).sum()/bars.Volume.sum())
730730
window = 5
731-
s = pd.concat([ (pd.Series(vwap(df.iloc[i:i+window]), index=[df.index[i+window]])) for i in range(len(df)-window) ]); s
731+
s = pd.concat([ (pd.Series(vwap(df.iloc[i:i+window]), index=[df.index[i+window]])) for i in range(len(df)-window) ]);
732+
s.round(2)
732733
733734
Timeseries
734735
----------

0 commit comments

Comments
 (0)