Project - Predicting Titanic Passenger Survival using Machine Learning and Python

4 / 21

Titanic Machine Learning Project - Split into Train and Test Set

Now you need to divide the dataset into train and test set.

INSTRUCTIONS

Import the Pandas library as pd as follows:

import pandas as << your code goes here >>

Add the following function as is:

def load_titanic_data(filename, titanic_path=TITANIC_PATH):
    csv_path = os.path.join(titanic_path, filename)
    return pd.read_csv(csv_path)

Split the data into train and test set by calling the function we created in step 2:

train_data = << your code comes here >>("train.csv")
test_data = << your code comes here >>("test.csv")
Get Hint See Answer


Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...