Answers for "how to split train test data in python"

3

train test split python

from sklearn.model_selection import train_test_split
				
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=42)
Posted by: Guest on December-01-2020
1

pandas split train test

from sklearn.model_selection import train_test_split


y = df.pop('output')
X = df

X_train,X_test,y_train,y_test = train_test_split(X.index,y,test_size=0.2)
X.iloc[X_train] # return dataframe train
Posted by: Guest on December-24-2020

Code answers related to "how to split train test data in python"

Python Answers by Framework

Browse Popular Code Answers by Language