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 :
WHO Region Country/Region (Count All)
Africa 48
Americas 35
Eastern Mediterranean 22
Europe 56
South-East Asia 10
Western Pacific 16
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()