text_html_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

df = pd.read_csv('/kaggle/input/time-series-datasets/monthly-beer-production-in-austr.csv')

df.Month = pd.to_datetime(df.Month)

df = df.set_index('Month')

rolling_mean = df.rolling(window=12).mean()
rolling_std = df.rolling(window=12).std()
plt.figure(figsize=(10, 6))
plt.plot(df, color='cornflowerblue', label='Original')
plt.plot(rolling_mean, color='firebrick', label='Rolling Mean')
plt.plot(rolling_std, color='limegreen', label='Rolling Std')
plt.xlabel('Date', size=12)
plt.ylabel('Monthly Beer Production', size=12)
plt.legend(loc='upper left')
plt.title('Rolling Statistics', size=14)
plt.show()