Dhananjaykhengare's picture
Upload 10 files
b9a43be verified
raw
history blame contribute delete
267 Bytes
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)