We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 13f659f commit 7aba1caCopy full SHA for 7aba1ca
doc/source/cookbook.rst
@@ -726,9 +726,10 @@ Rolling Apply to multiple columns where function returns a Scalar (Volume Weight
726
'Close' : np.random.randn(len(rng)),
727
'Volume' : np.random.randint(100,2000,len(rng))}, index=rng); df
728
729
- def vwap(bars): return ((bars.Close*bars.Volume).sum()/bars.Volume.sum()).round(2)
+ def vwap(bars): return ((bars.Close*bars.Volume).sum()/bars.Volume.sum())
730
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
+ 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)
733
734
Timeseries
735
----------
0 commit comments