single regression analysis with python

Asked 1 years ago, Updated 1 years ago, 347 views

I'm the first person to do regression analysis on python.
If you proceed as per the reference site, the error message
AttributeError
'LinearRegression' object has no attribute 'pledict' appears.
Please tell me the solution.
Here's the 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 vscode matplotlib

2022-12-26 02:50

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 06:41

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.