我要向遇到与我遇到的同一问题的人发布此问题:
当试图像这样拟合我的数据并打印结果时:
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'
答案 0 :(得分:0)
解决方案是添加.fit()
:
import statsmodel.api as sm
model = sm.OLS(df['SalePrice'], df.drop(['SalePrice'], axis=1)).fit()
print(model.summary())