File size: 528 Bytes
d927342 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# Split the dataset into test and train using random split
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
# Read dataset
df = pd.read_csv('formed_xyz_combined.csv')
# Split dataset
train_df, test_df = train_test_split(df, test_size=0.2, random_state=42)
# Save split subsets
train_df.to_csv('formed_xyz_train.csv', index=False)
test_df.to_csv('formed_xyz_test.csv', index=False)
print("Length of the train set is", len(train_df))
print("Length of the test set is", len(test_df)) |