模型介绍
https://blog.csdn.net/u012735708/article/details/82460962
实例介绍
给定某航班的乘客变化数据,使用ARIMA计算预测模型
代码
import pandas as pd
import numpy as np
from statsmodels.tsa.arima_model import ARIMA
import matplotlib as mpl
import matplotlib.pyplot as plt
import warnings
import matplotlib.patches as mpatches
from statsmodels.tools.sm_exceptions import HessianInversionWarning
def extend(a, b):
return 1.05*a-0.05*b, 1.05*b-0.05*a
def date_parser(date):
# 转换时间索引
return pd.datetime.strptime(date, '%Y-%m')
if __name__ == '__main__':
warnings.filterwarnings(action='ignore', category=HessianInversionWarning)
# 设置显示宽度
pd.set_option('display.width', 100)
# 全部打印,参数suppress表示是否用科学计数法来表示浮点数
np.set_printoptions(linewidth=100, suppress=True)
# 参数parse_dates为把某一列解析为时间索引;date_par