Skip to content

Instantly share code, notes, and snippets.

@stevenRush
Created February 21, 2018 09:01
Show Gist options
  • Save stevenRush/1b6b97844e83547e6ea294fe7c5f3420 to your computer and use it in GitHub Desktop.
Save stevenRush/1b6b97844e83547e6ea294fe7c5f3420 to your computer and use it in GitHub Desktop.
train = pd.read_csv("train.csv")
test = pd.read_csv("test.csv")
train_size = train.shape[0]
# extract label column before concatenating train and test
labels = train["Survived"]
train.drop("Survived", axis=1, inplace=True)
# concat train and test
all = pd.concat([train, test])
# preprocess features here
# ...
#
# split all into train and test
train = all.iloc[:train_size]
test = all.iloc[train_size:]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment