python 异常 endog has evaluated to an array with multiple columns that has shape (8, 8). ...

王小沫

关注

阅读 85

2022-10-17

1.异常信息

endog has eval(8, 8). This occurs when the variable converted to endog is non-numeric (e.g., bool or str).

image.png

2.异常原因

这个异常属于statsmodel当中做线性回归的时候自变量或者因变量为非数值类型

3.解决方案

将自变量和因变量转换为数值类型后重新进行回归,转换代码如下(使用对Series对象使用map函数)

stk_1["F012701B"] = stk_1["F012701B"].map(int)

精彩评论(0)

0 0 举报