我试图在数据集上实现sm.OLS(y,x).fit()
,但是错误指出y和x的长度不同。在我的代码中,较早的是x是通过合并data_prep_num = pd.merge(data_prep_num,data_prep_text_manual_onehot,right_index=True,left_index=True)
得出的,data_prep_num(after merging)
的维度为1458 X 81
,其中data_prep_num and data_prep_text_manual_onehot
的维度为1459 X x
。
如果我可以匹配x=data_prep_num
和y=data_sales_price_old
的尺寸,那么我猜这个错误可以解决> ValueError:Endog和Exog矩阵的大小不同。