“ OLS”对象没有属性“摘要”

时间:2019-11-11 12:35:43

标签: python pandas least-squares

我要向遇到与我遇到的同一问题的人发布此问题:

当试图像这样拟合我的数据并打印结果时:

import statsmodel.api as sm
model = sm.OLS(df['SalePrice'], df.drop(['SalePrice'], axis=1))
print(model.summary())

我收到以下错误:

AttributeError: 'OLS' object has no attribute 'summary'

1 个答案:

答案 0 :(得分:0)

解决方案是添加.fit()

import statsmodel.api as sm
model = sm.OLS(df['SalePrice'], df.drop(['SalePrice'], axis=1)).fit()
print(model.summary())
相关问题