I'm sorry if this question has already been answered, but I don't really know how to phrase my question.
I have a data frame structured in this way:
| country | year | score |
|---|---|---|
| France | 2020 | 10 |
| France | 2019 | 9 |
| Germany | 2020 | 15 |
| Germany | 2019 | 14 |
I would like to have a new column called previous_year_score that would look into the data frame looking for the "score" of a country for the "year - 1". In this case France 2020 would have a previous_year_score of 9, while France 2019 would have a NA.