0

I have a Dataframe that stores the information of the states of the US from 1910 to 2020, like this:

Name,Year,Population
al,1910,2138093
nv,1910,81875
nh,1910,430572
.
.
.
al,1920,3148097
nv,1920,151865
nh,1920,820582
...

And I want to tweak the Dataframe so it becomes something like this:

Year,ai,nv,nv.....
1910,2138093,81875,430572
1920,3148097,151865,820582
.
.
.

Each state name becomes column name, and its population in each year becomes its row content. Any tip is welcomed, thank you

Konrad Rudolph
  • 506,650
  • 124
  • 909
  • 1,183
Mattmmmmm
  • 125
  • 1
  • 5

0 Answers0