Question: Hi, I need help for the below question, because I got an error after my submission. Let me show you the default function in the

Hi, I need help for the below question, because I got an error after my submission.

Let me show you the default function in the lab first:

First default function:

def get_spam_dataset(filepath="data/spamdata.csv", test_split=0.1): ''' get_spam_dataset Loads csv file located at "filepath". Shuffles the data and splits it so that the you have (1-test_split)*100% training examples and (test_split)*100% testing examples. Args: filepath: location of the csv file test_split: percentage/100 of the data should be the testing split Returns: X_train, X_test, y_train, y_test, feature_names (in that order) first four are np.ndarray ''' # your code here data=pd.read.csv('data/spamdata.csv') x = df.iloc[:,1:] y = df.iloc[:,0] X_train, X_test, y_train, y_test, feature_names = train_test_split(x, y, test_size=0.1, shuffles=True) return X_train, X_test, y_train, y_test, feature_names return 0

Question and My Answer are in the same code cell:

# TO-DO: import the data set into five variables: X_train, X_test, y_train, y_test, label_names # Uncomment and edit the line below to complete this task. test_split = 0.1 # default test_split; change it if you'd like; ensure that this variable is used as an argument to your function # your code here X_train, X_test, y_train, y_test, label_names = get_spam_dataset()-MY ANSWER X_train, X_test, y_train, y_test, label_names = np.arange(5) - THIS CODE IS ALREADY PROVIDED IN THE LAB

An Error after my submission:

IndexError Traceback (most recent call last)  in  Traceback Redacted IndexError: tuple index out of range

Please help me on the coding. Thank you so much.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!