【发布时间】:2020-09-21 19:08:48
【问题描述】:
我的代码:
import pandas as pd
from sklearn.Linear_model import LinearRegression as lr
df = pd.DataFrame({"Match Score":[95,85,80,70,60], "Statistic score":[85,95,70,65,70]})
x =df[["Match Score"]]
y =df["Statistic score"]
lr.fit(x,y)
错误详情:
TypeError Traceback (most recent call last)
<ipython-input-19-e644bf405118> in <module>
----> 1 lr.fit(x,y)
TypeError: fit() missing 1 required positional argument: 'y'
【问题讨论】:
-
lr().fit(x,y) -
您的
y缺少第二组方括号。
标签: python pandas scikit-learn linear-regression