0

I'm trying to manipulate a table with a date column as well as a name column with only 4 different, yet repeating names. the last column is a count column, reflecting how many times this name appeared per date. the raw df looks like so

name date count
Adam 2015-03-01 206
Nancy 2015-03-01 45
Bob 2015-03-01 76
Ahron 2015-03-01 23
Adam 2015-04-01 66
Nancy 2015-04-01 4
Bob 2015-04-01 877
Ahron 2015-04-01 12

now I want to convert the names to the column headers like so

date Adam Nancy Bob Ahron
2015-03-01 206 45 76 23
2015-04-01 66 4 877 12

I tried using groupby(df['name']) or df.pivot() but couldn't get no satisfactory result...

sammywemmy
  • 22,944
  • 4
  • 14
  • 28
RSNboim
  • 134
  • 1
  • 8

0 Answers0