Jacob Stern
Jacob Stern

Reputation: 4587

'OLS' object has no attribute 'summary'

I'm posting this question for those who ran into the same issue I ran into:

When trying to fit my data like so, and printing the result:

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

I get the following error:

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

Upvotes: 1

Views: 9516

Answers (1)

Jacob Stern
Jacob Stern

Reputation: 4587

The solution was to add .fit():

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

Upvotes: 5

Related Questions