#对模型进行定阶pmax = int(len(df) / 10) #一般阶数不超过 length /10qmax = int(len(df) / 10)bic_matrix = []for p in range(pmax +1): temp= [] for q in range(qmax+1): try: temp.append(ARIMA(data, (p, 1, q)).fit().bic) except: temp.append(None) bic_matrix.append(temp)bic_matrix = pd.DataFrame(bic_matrix) #将其转换成Dataframe 数据结构p,q = bic_matrix.stack().astype('float64').idxmin() #先使用stack 展平, 然后使用 idxmin 找出最小值的位置print(u'BIC 最小的p值和q值:%s,%s' %(p,q)) # BIC 最小的p值 和 q 值:0,1#所以可以建立ARIMA 模型,ARIMA(0,1,1)
报错 attempt to get argmin of an empty sequence