Skip to content

Instantly share code, notes, and snippets.

@willywildan
Created December 12, 2021 13:58
Show Gist options
  • Save willywildan/d333ef256fdc9a54e8c840fdc40cd0b9 to your computer and use it in GitHub Desktop.
Save willywildan/d333ef256fdc9a54e8c840fdc40cd0b9 to your computer and use it in GitHub Desktop.
#1
def concat_df(train_data, test_data):
#Returns a concatenated df of training and test set
return pd.concat([train_data, test_data], sort=True).reset_index(drop=True)
#2
df_train = pd.read_csv('https://storage.googleapis.com/dqlab-dataset/challenge/feature-engineering/titanic_train.csv')
df_test = pd.read_csv('https://storage.googleapis.com/dqlab-dataset/challenge/feature-engineering/titanic_test.csv')
df_all = concat_df(df_train, df_test)
#3
df_train.name = 'Training Set'
df_test.name = 'Test Set'
df_all.name = 'All Set'
#4
dfs = [df_train, df_test]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment