Question: My code below gives an error from line 19, stating there is no dataframe. # load the necessary modules import numpy as np import pandas

My code below gives an error from line 19, stating there is no dataframe.
# load the necessary modules import numpy as np import pandas as pd import statsmodels.formula.api as sms
wine = pd.read_csv('wine.csv') # load wine.csv
model =sms.ols(formula='quality~chlorides + pH + alcohol',data=wine).fit() # fit a multiple regression model using the sms.ols function
test= pd.DataFrame.from_dict({'chlorides':['chlorides'],'pH':['pH'],'alcohol':['alcohol']}) test.head()
chlorides = float(input()) pH = float(input()) alcohol = float(input())
prediction = model.predict(exog = test)# use the model.predict function to find the predicted value for quality using # the input values for chlorides, pH, and alcohol
print(prediction)
2.10 LAB: Making predictions using MLR models The wine dataset contains 4,898 instances with 11 features that include pH, percentage of alcohol, and others, used to predict wine quality. Constructing a box plot for the free sulphur dioxide feature shows a right-skewed distribution. Write a program that creates a model that uses chlorides, pH, and alcohol as predictor variables and returns the quality as the response variable. If the inputs are: 0.03410 the output should be: 0 0 \begin{tabular}{l|l} LAB & 2.10.1: LAB: Making predictions using MLR models \end{tabular} 0/3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
