0

I would like to split a dataframe with train_test_split from sklearn.

I know how to do it but I would like to keep rows having same value in same dataframe.

Example:

col_1    original_name
'a_b_1'  'a_b'
'a_b_2'  'a_b'
'c_b_1'  'c_b'
'c_b_2'  'c_b'

So when I split I want to be sure that rows having same 'original_name' value are in the same dataframe.

How can I do this ?

codelifevcd
  • 105
  • 1
  • 6

0 Answers0