import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from statsmodels.tsa.api import ExponentialSmoothing
data = pd.read_excel('时间序列预测数据集.xlsx')
# data.columns=[时间,投递人数,投递次数,工程师投递人数,工程师投递次数,招聘发布公司量,发布职位量,工程师岗位发布公司,工程师岗位发布量]
for i in data.drop('时间',axis=1).columns:
y = data[i][:37]
ets = ExponentialSmoothing(y, trend='add', seasonal='add', seasonal_periods=12)
r = ets.fit()
pred = r.predict(start=len(y), end=len(y) + 12)
data[i][37:] = pred
pd.DataFrame({
'origin': data[i],
'fitted': r.fittedvalues,
'pred': pred
}).plot(legend=True)
plt.title(i)
data
https://www.cnblogs.com/lfri/p/12243268.html