April 2019
Intermediate to advanced
426 pages
11h 13m
English
One way of analyzing the distribution of returns is measuring its standard deviation. Standard deviation is a measure of dispersion around the mean. A high standard deviation value for past returns indicates a high historical volatility of stock price movement.
The rolling() method of pandas helps us to visualize specific time series operations over a period of time. To calculate standard deviations of the percentage change of returns in our computed ABN dataset, we use the std() method, which returns a DataFrame or Series object that can be used to plot a chart. The following example illustrates this:
In [ ]: df_filled = df.asfreq('D', method='ffill') df_returns = df_filled.pct_change() df_std = df_returns.rolling(window=30, ...Read now
Unlock full access