text_plain_output_4.png application_vnd.jupyter.stderr_output_3.png application_vnd.jupyter.stderr_output_5.png text_html_output_1.png text_plain_output_2.png application_vnd.jupyter.stderr_output_1.png
from statsmodels.tsa.statespace.sarimax import SARIMAX

import matplotlib.pyplot as plt

import pandas as pd

data = pd.read_csv('../input/time-series-datasets/Electric_Production.csv')

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')

plt.xlabel = 'Dates'
plt.ylabel = 'Total Production'

train_data = df[:len(df) - 12]
test_data = df[len(df) - 12:]

arima_model = SARIMAX(train_data['Monthly beer production'], order=(2, 1, 1), seasonal_order=(4, 0, 3, 12))
arima_result = arima_model.fit()
arima_result.summary()

arima_pred = arima_result.predict(start=len(train_data), end=len(df) - 1, typ='levels').rename('ARIMA Predictions')
arima_pred

test_data['ARIMA_Predictions'] = arima_pred