I want to write code that read a csv file and then use linear regression for prediction.
The CSV file is like this:
| math | physics |
|---|---|
| 17 | 15 |
| 16 | 12 |
| 18 | 19 |
I try this code:
import pandas as pd
from sklearn.linear_model import LinearRegression
score_file = pd.read_csv('scores.csv')
math_score = score_file['math']
physic_score = score_file['physics']
cls = LinearRegression().fit(math_score,physic_score)
but it gives me this error:
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample