Question: Hi , This Question is creating so much problem for me . I was able to get the result but when loading to Code Grade,
Hi This Question is creating so much problem for me I was able to get the result but when loading to Code Grade, I get an error message "IndexError: list index out of range
I spend so much time trying to solve this problem using python and sysargv but was not successful. This is the code I used
import sys
import pandas as pd
import statsmodels.api as sm
def main:
if lensysargv:
printUsage: python german.py
#sysexit
return
filepath sysargv
try:
data pdreadcsvfilepath
except FileNotFoundError:
printFile not found."
#sysexit
return
data.renamecolumnsCredit amount': 'Creditamount' inplaceTrue
X smaddconstantdataAge 'Duration'
y dataCreditamount'
model smOLSy Xfit
#printParameters:
printmodelparams.round
#printnRsquared:"
printmodelrsquared.round
if namemain:
maingermanpy
Use the germancreditdata.csv file to complete the following assignment.
Create a file,
german.py that loads the csv file and runs a regression predicting
credit amount from age and duration, in that order. Add a constant using
smaddconstantdata
You will need to rename the column 'Credit amount' to 'Creditamount'.
Then, print the parameters and Rsquared to decimals using
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
