import pandas as pd
import numpy as np
from statsmodels.tsa.arima_model import ARIMA
import matplotlib.pyplot as plt
# 加载数据
data = pd.read_csv('your_data.csv', index_col='date', parse_dates=True)
# 拟合ARIMA模型
model = ARIMA(data, order=(1, 1, 1))
results = model.fit()
# 预测未来n个时间点的值
n = 10
forecast = results.forecast(steps=n)
# 绘制原始数据和预测结果
plt.plot(data, label='原始数据')
plt.plot(pd.date_range(start=data.index[-1], periods=n+1, freq=data.index.freq)[1:], forecast, label='预测结果')
plt.legend()
plt.show()