Split data into test, training and validation when some patients have multiple observations

Viewed 14

I need to separate my df in train and test, the problem is that this df have multiple observations for each patient, i have a column with the ID of the patient. The problem is that there are patients that appears in more than one set, I need that all the observations of a patient are in the same set. I don't know how to do it, i found how to do it on R, but i need to do it in Python.

0 Answers
Related