1

I am trying to make a pie plot from a CSV file but it is not coming as expected as I wanted the a comparison of number of countries as an output and the code is below : The Output of the pie-plot :

enter image description here

WHO Region  Country/Region (Count All)
Africa  48
Americas    35
Eastern Mediterranean   22
Europe  56
South-East Asia 10
Western Pacific 16

The Link for CSV file

df2 = pd.read_csv('PC.csv')

df2.head()

df2 = df.rename(columns={"WHO Region":"WHO_Regions","Country/Region (Count 
All)":"Countries"})

df2.head(6)

data_pie=df2['WHO_Regions'].value_counts().rename_axis('WHO_Regions').reset_index(name='Countries')

plt.figure(figsize=(10,10))

plt.pie(data_pie.Countries, labels=data_pie.WHO_Regions, startangle=45,autopct='%1.1f%%')

plt.title('Count of Active cases')

plt.show()
Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
  • What is ```data_pie.Countries```? – fdireito Nov 14 '21 at 08:42
  • 1
    Does this answer your question? [Matplotlib pie-chart: How to replace auto-labelled relative values by absolute values](https://stackoverflow.com/q/14171021/7758804) or [How to have actual values in matplotlib Pie Chart displayed (Python)?](https://stackoverflow.com/q/41088236/7758804) – Trenton McKinney Nov 14 '21 at 15:24

0 Answers0