Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

split data train, test by id python

train_inds, test_inds = next(GroupShuffleSplit(test_size=.20, n_splits=2, random_state = 7).split(df, groups=df['Group_Id']))

train = df.iloc[train_inds]
test = df.iloc[test_inds]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #split #data #test #id #python
ADD COMMENT
Topic
Name
7+2 =