sorry, if my title sounds a bit confusing. What I'm basically trying to do is adding new rows in a data frame, where I duplicate the value of each unique value of one column, while another column's new values are changing.
This is what my data frame looks like:
| id | year |
|---|---|
| 01 | 2022 |
| 02 | 2022 |
| 03 | 2022 |
| ... | ... |
| 99 | 2022 |
And I want it to look like this:
| id | year |
|---|---|
| 01 | 2022 |
| 01 | 2023 |
| 01 | 2024 |
| 02 | 2022 |
| 02 | 2023 |
| 02 | 2024 |
| 03 | 2022 |
| ... | ... |
| 99 | 2024 |
I.e. I want for every id to add the years 2023 and 2024 in the year column. I tried doing this with an apply function, but it always didn't work out, could you guys help me out in solving this?