I have a table with the names of the countries in the columns and the names of the years in the first rows, with the values: the number of population in that country in that year. How do I change this table so that the columns are Year, country and value. I learn the first table is a pivot table. Then how can i change pivot table to a dataframe?
The first table looks like this
Year | China | India | .... |
---|---|---|---|
2021 | 1.311.750.000 | 1.274.917.850 | .... |
2022 | 1.411.750.000 | 1.374.917.850 | .... |
So a table whose content will be as follows
year | country | value |
---|---|---|
2022 | China | 1.411.750.000 |
2022 | India | 1.374.917.850 |
.... | ..... | .... |
Thanks in advance for your help