当前位置 : 主页 > 编程语言 > python >

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

来源:互联网 收集:自由互联 发布时间:2022-10-26
1.异常信息 endog has evaluated to an array with multiple columns that has shape (8, 8). This occurs when the variable converted to endog is non-numeric (e.g., bool or str). 2.异常原因 这个异常属于statsmodel当中做线性回归的

1.异常信息

endog has evaluated to an array with multiple columns that has shape (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)
网友评论