ESarousi
ESarousi

Reputation: 47

Pie chart from several columns - Python

everyone! I'm trying to make a pie chart from a pandas df but they're all from different columns. Here's what I have:

enter image description here

I'd like to have a pie where each slice is the approve, disapprove or none column. Any suggestions?

Upvotes: 1

Views: 460

Answers (1)

Nk03
Nk03

Reputation: 14949

IIUC, you can try:

import pandas as pd

df = pd.DataFrame({
    'Issue': ['Issue1', 'Issue2', 'Issue3', 'Issue4'],
    'Approve': [52, 49, 48, 47],
    'Disapprove': [40, 51, 60, 34],
    'None': [7, 8, 9, 10],
})

df.set_index('Issue').plot.pie(subplots=True,  figsize=(20, 10))

OUTPUT:

enter image description here

Upvotes: 1

Related Questions