I have the following dataset, with multiple patient_IDs and treatment Dates, per patient_ID:
| Patient_ID | Dates | Col_X | Col_Y |
|---|---|---|---|
| 2038 | 2012-01-02 | InfoX | InfoY |
| 2038 | 2012-02-13 | InfoX | InfoY |
| 2038 | 2012-02-27 | InfoX | InfoY |
| 2120 | 2005-02-05 | InfoX | InfoY |
| 2120 | 2009-03-31 | InfoX | InfoY |
What I want to do is, I want to re-organise my dataframe by getting all columns but only for the maximum Date per Patient_ID.
I tried to use groupby, but I don't seem to be able to save all the information from columns per Patient_ID.
Any ideas, would be greatly appreciated.