plt.figure(figsize=(16,8)) df_shift = df_log - df_log.shift(periods = 1) MAvg_shift = df_shift.rolling(window=12).mean() MStd_shift = df_shift.rolling(window=12).std() plt.plot(df_shift, color='c') plt.plot(MAvg_shift, color='red', label = 'Moving Average') plt.plot(MStd_shift, color='green', label = 'Standard Deviation') plt.legend() plt.show() #Dropping the null values that we get after applying differencing method df_shift = df_shift.dropna()