Skip to content

Instantly share code, notes, and snippets.

@ryancodingg
Last active September 9, 2024 11:32
Show Gist options
  • Save ryancodingg/e219ae28a220c8daa5535986d0cd52e6 to your computer and use it in GitHub Desktop.
Save ryancodingg/e219ae28a220c8daa5535986d0cd52e6 to your computer and use it in GitHub Desktop.
Spliting data
#Split the data into training and test sets using Stratified splitting
X = df.drop(columns=['is_fraud'])
y = df['is_fraud']
X_train, X_test, y_train, y_test = train_test_split(X, y, stratify=y, test_size = 0.3, random_state = 42)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment