This is my dataframe:
| ID number | Date purchase | 
|---|---|
| 1 | 2022-05-01 | 
| 1 | 2021-03-03 | 
| 1 | 2020-01-03 | 
| 2 | 2019-01-03 | 
| 2 | 2018-01-03 | 
I want to get a horizontal dataframe with alle the dates in seperate columns per ID number.
So like this:
| ID number | Date 1 | Date 2 | Date 3 | 
|---|---|---|---|
| 1 | 2022-05-01 | 2021-03-03 | 2020-01-03 | 
| 2 | 2019-01-03 | 2018-01-03 | 
After I did this I want to calculate the difference between these dates.
 
     
     
    