Skip to content

Instantly share code, notes, and snippets.

@prateekjoshi565
Created July 29, 2019 09:42
Show Gist options
  • Save prateekjoshi565/2ca82b918c2003423a834f7640632404 to your computer and use it in GitHub Desktop.
Save prateekjoshi565/2ca82b918c2003423a834f7640632404 to your computer and use it in GitHub Desktop.
# shuffle customer ID's
random.shuffle(customers)
# extract 90% of customer ID's
customers_train = [customers[i] for i in range(round(0.9*len(customers)))]
# split data into train and validation set
train_df = df[df['CustomerID'].isin(customers_train)]
validation_df = df[~df['CustomerID'].isin(customers_train)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment