Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pandas split dataframe to train and test

train=df.sample(frac=0.8,random_state=200) #random state is a seed value
test=df.drop(train.index)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pandas #split #dataframe #train #test
ADD COMMENT
Topic
Name
7+5 =