1.异常信息
endog has eval(8, 8). This occurs when the variable converted to endog is non-numeric (e.g., bool or str).
2.异常原因
这个异常属于statsmodel
当中做线性回归的时候自变量或者因变量为非数值类型
3.解决方案
将自变量和因变量转换为数值类型后重新进行回归,转换代码如下(使用对Series
对象使用map
函数)
stk_1["F012701B"] = stk_1["F012701B"].map(int)