﻿ Python Project: Get the top 10 countries data of Novel Coronavirus - w3resource

# Python Exercise: Get the top 10 countries data of Novel Coronavirus

## Python Project: COVID-19 Exercise-9 with Solution

Write a Python program to get the top 10 countries data (Last Update, Country/Region, Confirmed, Deaths, Recovered) of Novel Coronavirus (COVID-19).

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-18-2020.csv', usecols = ['Last Update', 'Country/Region', 'Confirmed', 'Deaths', 'Recovered'])
result = covid_data.groupby('Country/Region').max().sort_values(by='Confirmed', ascending=False)[:10]
pd.set_option('display.max_column', None)
print(result)
```
```

Sample Output:

```Dataset information:
&                        Last Update  Confirmed  Deaths  Recovered
Country/Region
China           2020-03-18T12:13:09      67800    3122      56927
Italy           2020-03-18T17:33:05      35713    2978       4025
Iran            2020-03-18T12:33:02      17361    1135       5389
Spain           2020-03-18T13:13:13      13910     623       1081
Germany         2020-03-18T19:33:02      12327      28        105
France          2020-03-18T18:33:02       9043     148         12
Korea, South    2020-03-18T02:53:03       8413      84       1540
Switzerland     2020-03-18T14:53:05       3028      28         15
United Kingdom  2020-03-18T14:53:05       2626      71         65
US              2020-03-18T19:53:03       2495      55        106
```

Python Code Editor:

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

What is the difficulty level of this exercise?

﻿