Error performing single regression analysis in Python AttributeError 'LinearRegression' object has no attribute 'pledict'

Asked 1 years ago, Updated 1 years ago, 258 views

When I try to perform regression analysis in Python, I get an error when I proceed as per the site I refer to.Please tell me the solution.

error message

AttributeError
'LinearRegression' object has no attribute 'pledict'

source code

import pandas as pd
import matplotlib.pyplot asplt
import time
from sklearn.linear_model import LinearRegression
import seaborn

df = pd.read_csv("path of csv")
time.sleep(0.5)
x = df [['x']]
y = df [['y']]
model=LinearRegression()
model.fit(x,y)
plt.plot(x,y,'o')
plt.plot(x,model.pledict(x))<<<Error here
plt.show()

Additional
Rewrite the same amount and
in the same place. AttributeError
'DataFrame' object has no attribute 'model' appears

python matplotlib

2022-12-26 21:53

1 Answers

The spelling is different.

  • Before Correction
plt.plot(x,model.pledict(x))<<<Error here
  • Corrected
plt.plot(x,model.predict(x))<<<Error here


2022-12-26 23:53

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.