import numpy as np def test_run(): a = np.array([(1, 2, 3, 4, 5),(10, 20, 30, 40, 50)]) print "Original array a:\n", a print "\nMultiply a by 2:\n", 2 * a if __name__ == "__main__": test_run()
Rolling statistics is buying opportunity
rolling standard dev
def test_run(): dates = pd.date_range('2012-01-01','2012-12-31') symbols = ['SPY'] df = get_data(symbols, dates) ax = df['SPY'].plot(title="SPY rolling mean", label='SPY') rm_SPY = pd.rolling_mean(df['SPY'], window=20) rm_SPY.plot(label='Rolling mean', ax=ax)