Use dataframe operations to calculate statistics across the entire dataframe
mean = df1.mean() โ gives the mean of each columnSplit the data into windows, where we calculate the average across a time period and compare it to other data

<aside> ๐ SUMMARY: Dataframe allow us to calculate various statistics, and we can do global or rolling ones.
</aside>
Bollinger bands are a form of technical analysis. If the price crosses the bands, then we might want to take action


# Rolling mean
rm = df.rolling(window=20).mean() # Average over 20 days
# Rolling s.d.
rstd = df.rolling(window=20).std()
# Get bands
upper_band = rm + 2*rstd
lower_band = rm - 2*rstd
# Plot the graphs
ax = df['SPY'].plot(title="Bollinger Bands", label='SPY')
rm.plot(label='Rolling mean', ax=ax)
upper_band.plot(label='upper band', ax=ax)
lower_band.plot(label='lower band', ax=ax)
Daily returns is another indicator on how a stock might be performing, with a positive daily return being better.
<aside> ๐ SUMMARY: We can use different indicators to help us see what a stockโs performance is, like Bollinger bands, daily returns and cumulative returns
</aside>