File size: 267 Bytes
b9a43be |
1 2 3 4 5 6 7 |
from sklearn.model_selection import train_test_split
def split_data(df, target_col, test_size=0.2, random_state=42):
X = df.drop(columns=[target_col])
y = df[target_col]
return train_test_split(X, y, test_size=test_size, random_state=random_state)
|