📜  拆分数据列车,通过 id 测试 python 代码示例

📅  最后修改于: 2022-03-11 14:46:20.340000             🧑  作者: Mango

代码示例1
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]