Reputation: 167
I have a Dataframe like this:
Hours Person
10 Jack
20 Louis
10 Jack
30 Anne
10 Anne
And I want to represent this data as a pie chart where 50% of the hours belongs to Anne, 25% to Jack an 25% to Louis. I have tried with goupby but it doesn´t represent what I want.
Upvotes: 0
Views: 26
Reputation: 150745
Try:
df.groupby('Person')['Hours'].sum().plot.pie(autopct='%.2f')
Output:
Upvotes: 1