Plotting pie chart of COVID-19 details for each country
John Hopkins university Data
from covid import Covid
from matplotlib import pyplot as plt
#from win
covid=Covid()
covid.get_data()
arr={}
l=[]
c=[]
other=0
for t in range(1,176):
cases=covid.get_status_by_country_id(t)
if cases['confirmed']<250000:
other=other+cases['confirmed']
else:
c.append(cases['confirmed'])
l.append(cases['country'].title())
c.append(other)
l.append("Other < 250000")
plt.title("Total COVID-19 numbers "+str(sum(c)))
plt.pie(c,labels=l,counterclock=True,startangle=90,radius=1,autopct='%1.1f%%')
plt.show()