帮我看下这段代码为什么有错?
import numpy as npimport pandas as pd
import statsmodels.api as sm
import statsmodels.formula.api as smf
import matplotlib.pyplot as plt
df = pd.read_excel('COVAR1.xlsx',sheet_name = 'Sheet1') #修改
for year in range(2007,2021):
for semi in :
for bank in range(6,38):
select = df.loc[(df['year'] == year) & (df['semi'] == semi)]
row_num = select.shape
Xi = select.iloc
Mi = select.iloc
mod = smf.quantreg(Xi,Mi)
res = mod.fit(q=.05)
print(res.params)
报错:PatsyError: model is missing required outcome variables
可能是mod = smf.quantreg(Xi,Mi)有问题,但不知道怎么改 你的报错提示,没有哪一行代码出错的提示?可能?
网上是这么写的:mod = smf.quantreg('foodexp ~ income', data)
res = mod.fit(q=.5)
你这没给数据,也不知道你的Xi是怎么样的
页:
[1]