w3resource

Python Exercise: List countries with no cases of Novel Coronavirus recovered

Python Project: COVID-19 Exercise-6 with Solution

Write a Python program to list countries with no cases of Novel Coronavirus (COVID-19) recovered.

Sample Solution:

Python Code:

import pandas as pd
covid_data= pd.read_csv('https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_daily_reports/03-17-2020.csv')
data = covid_data.groupby('Country/Region')['Confirmed', 'Deaths', 'Recovered'].sum().reset_index()
result = data[data['Recovered']==0][['Country/Region', 'Confirmed', 'Deaths', 'Recovered']]
print(result)

Sample Output:

                       Country/Region  Confirmed  Deaths  Recovered
1                             Albania         55       1          0
4                 Antigua and Barbuda          1       0          0
7                               Aruba          3       0          0
13                           Barbados          2       0          0
16                              Benin          1       0          0
17                             Bhutan          1       0          0
18                            Bolivia         11       0          0
21                             Brunei         56       0          0
22                           Bulgaria         67       2          0
23                       Burkina Faso         15       0          0
25                           Cameroon         10       0          0
27           Central African Republic          1       0          0
28                              Chile        201       0          0
31                Congo (Brazzaville)          1       0          0
32                   Congo (Kinshasa)          3       0          0
33                         Costa Rica         41       0          0
37                               Cuba          5       0          0
38                             Cyprus         46       0          0
41                 Dominican Republic         21       1          0
42                            Ecuador         58       2          0
44                  Equatorial Guinea          1       0          0
46                           Eswatini          1       0          0
47                           Ethiopia          5       0          0
50                      French Guiana         11       0          0
51                              Gabon          1       0          0
54                              Ghana          7       0          0
56                          Greenland          1       0          0
57                         Guadeloupe         18       0          0
58                               Guam          3       0          0
59                          Guatemala          6       1          0
60                           Guernsey          0       0          0
61                             Guinea          1       0          0
62                             Guyana          7       1          0
63                           Holy See          1       0          0
64                           Honduras          8       0          0
66                            Iceland        220       1          0
76                             Jersey          0       0          0
78                         Kazakhstan         33       0          0
79                              Kenya          3       0          0
81                             Kosovo          2       0          0
85                            Liberia          1       0          0
86                      Liechtenstein          7       0          0
88                         Luxembourg        140       1          0
90                           Maldives         13       0          0
92                         Martinique         16       1          0
93                         Mauritania          1       0          0
94                            Mayotte          1       0          0
97                             Monaco          7       0          0
98                           Mongolia          5       0          0
99                         Montenegro          2       0          0
101                           Namibia          2       0          0
104                       New Zealand         12       0          0
105                           Nigeria          3       0          0
110                            Panama         69       1          0
111                          Paraguay          9       0          0
116                       Puerto Rico          0       0          0
118             Republic of the Congo          0       0          0
119                           Reunion          9       0          0
122                            Rwanda          7       0          0
123                       Saint Lucia          2       0          0
124  Saint Vincent and the Grenadines          1       0          0
129                        Seychelles          4       0          0
131                          Slovakia         72       0          0
132                          Slovenia        275       1          0
133                           Somalia          1       0          0
134                      South Africa         62       0          0
137                             Sudan          1       1          0
138                          Suriname          1       0          0
142                          Tanzania          1       0          0
144                       The Bahamas          1       0          0
145                        The Gambia          1       0          0
146                              Togo          1       0          0
147               Trinidad and Tobago          5       0          0
148                           Tunisia         24       0          0
149                            Turkey         47       1          0
151                           Ukraine         14       2          0
154                           Uruguay         29       0          0
155                        Uzbekistan         10       0          0
156                         Venezuela         33       0          0
158    occupied Palestinian territory          0       0          0

Python Code Editor:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a Python program to get the latest country wise deaths cases of Novel Coronavirus (COVID-19).
Next: Write a Python program to list countries with all cases of Novel Coronavirus (COVID-19) died.

What is the difficulty level of this exercise?



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://198.211.115.131/python-exercises/project/covid-19/python-covid-19-exercise-6.php