Multiple regression is like linear regression, but more than one independent value, meaning that we try to predict a value based on two or more variables.
In Python we have modules. Start by importing the Pandas module.
import pandas
The Pandas module allows us to read csv files and restore DataFrame object.
df = pandas.read_csv("cars.csv")
Then make a list of the independent values and call this variable X.
Enter values based on a variable called y.
X = df[['Weight', 'Volume']]]
y = df['CO2']
We will use other methods from the sklearn module, so we will need to import that module:
We have predicted that a 1.3-liter engine, weighing 2300 kg, will emit about 107 grams of CO2 per kilometer.