I have dataframe which is pretty similar to following
index | date | result |
---|---|---|
AAA111 | 19/05/2021 | Win |
AAA111 | 29/05/2021 | Lose |
AAA112 | 19/05/2021 | Win |
AAA112 | 24/05/2021 | Win |
AAA113 | 29/05/2021 | Lose |
I would like to get something like this
index | date_1 | date_2 | result_day_1 | result_day_2 |
---|---|---|---|---|
AAA111 | 19/05/2021 | 29/05/2021 | Win | Lose |
AAA112 | 19/05/2021 | 24/05/2021 | Win | Win |
AAA113 | 29/05/2021 | NA | Lose | NA |
Not all the index have same number of days as above.