Normal distributions approximately follow the 68-95-99.7 rule--meaning that 68% of the data falls between 1 standard deviation of the mean, 95% between 2, and 99.7% between 3. We will now calculate the percentage of daily returns that fall between 1, 2, and 3 standard deviations from the mean. For this, we will need the mean and standard deviation:
>>> mean = amzn_daily_return.mean() >>> std = amzn_daily_return.std()
Calculate the absolute value of the z-score for each observation. The z-score is the number of standard deviations away from the mean:
Find the percentage of returns that are within 1, 2, and 3 standard deviations:
>>> pcts = [abs_z_score.lt(i).mean() for i in range(1,4)] >>> print('{:.3f} fall within 1 standard deviation. ' '{:.3f} within 2 and {:.3f} within 3'.format(*pcts)) 0.787 fall within 1 standard deviation. 0.957 within 2 and 0.985 within 3