I am trying to transpose a spreadsheet (or dataframe) about yearly life expectancy from a lot countries that looks like this:
| Country | 1989 | 1990 | 1991 |
|---|---|---|---|
| Albania | 0.298 | 0.516 | 0.789 |
| Argentina | 0.445 | 0.698 | 0.222 |
| Mexico | 0.898 | 0.216 | 0.125 |
| Argentina | 0.468 | 0.654 | 0.987 |
This table goes on up to 2021 and has over 100 countries. I would prefer to have an individual row for the data of each year for each country, it should be like this:
| Country | Year | Life Expectancy |
|---|---|---|
| Albania | 1989 | 0.516 |
| Albania | 1990 | 0.789 |
| Albania | 1991 | 0.789 |
| Argentina | 1989 | 0.445 |
| Argentina | 1990 | 0.698 |
| Argentina | 1991 | 0.222 |
How could I do this ? Last time I had to do something like this I transposed everything manually in Excel and it was time consuming. How could I do this quickly ?
Any help is appreciated