小编flo*_*ian的帖子

statsmodels中的add_constant()不起作用

我尝试将add_constant()函数与数据集数组一起使用.在索引59处它起作用(列被创建)但在索引60处它不被创建.最初,testmat [59]的形状为(24,54),testmat [60]的形状为(9,54).以下是我运行add_constant函数时得到的结果:

In: Xnew = sm.add_constant(testmat[59])
Out:
     const  TRYSIL_PO   TRYSIL_TA
6142    1   985.7       271.65
6143    1   984.9       271.85
Run Code Online (Sandbox Code Playgroud)
In: Xnew = sm.add_constant(testmat[60]):
Out:
     TRYSIL_PO  TRYSIL_TA
6166    983.6   272.75
6167    983.1   272.85
Run Code Online (Sandbox Code Playgroud)

我已经检查了其他来源,但似乎这个没有得到解决.你有解释吗?

python-3.x statsmodels

9
推荐指数
1
解决办法
4795
查看次数

标签 统计

python-3.x ×1

statsmodels ×1