November 2019
Intermediate to advanced
346 pages
9h 36m
English
In the following steps, we demonstrate several methods for making predictions using time series data:
from random import randomtime_series = [2 * x + random() for x in range(1, 100)]
%matplotlib inlineimport matplotlib.pyplot as pltplt.plot(time_series)plt.show()
The following screenshot shows the output:

from statsmodels.tsa.ar_model import ARmodel = AR(time_series)model_fit = model.fit()y = model_fit.predict(len(time_series), len(time_series)) ...