0

I have a pandas dataframe which has two columns type and name.

               Type               Name
0             Third               Jake
1            Second               Tang
2            Second               Rose
3             Other               Rose
4            Second               Jake
5             First                Sam  
6             First                Tom

How can I group both the columns- type and name and have result like this:

Name    First  Second  Third  Other
Jake     0       1       1      0
Tang     0       1       0      0
Rose     0       1       0      1
Sam      1       0       0      0 
Tom      1       0       0      0

Please suggest!

sudeep
  • 93
  • 2
  • 6
  • 17

0 Answers0