So I successfully split my dataset into Train & Test in a ratio of 70:30 I used this:
df_glass['split'] = np.random.randn(df_glass.shape[0], 1)
msk = np.random.rand(len(df_glass)) <= 0.7
train = df_glass[msk]
test = df_glass[~msk]
print(train)
print(test)
Now how do I split train and test to X_train
and y_train
and X_test
and y_test
Such that, X
denotes the features of the database and y denotes the response?
I need to do supervised learning and apply ML modules on X_Train
and y_Train
.
My database looks like this: Database_snippet