1

I have some data like this:

df = [
    ['year','name','data'],
      ['2001','A',1],
      ['2002','A',2],
      ['2003','A',3],
      ['2001','B',2],
      ['2002','B',5],
      ['2003','B',9],
      ['2001','C',7],
      ['2002','C',3],
      ['2003','C',1]
]

what I am trying to get is something like this:

year   A   B   C
2001   1   2   7
2002   2   3   3
2003   3   9   1

how do I do it?

Tried a couple of things but still haven't figured out. New to python.Thanks a lot.

Rexwag
  • 11
  • 1

0 Answers0