Last active
May 20, 2020 09:56
-
-
Save LowriWilliams/8ec95a4f0242c6fe9e62b379569ec9e8 to your computer and use it in GitHub Desktop.
corona/total_coronavirus_cases
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 66, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"\n", | |
"Total number of confirmed cases: 376297 \n", | |
"\n" | |
] | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<div>\n", | |
"<style scoped>\n", | |
" .dataframe tbody tr th:only-of-type {\n", | |
" vertical-align: middle;\n", | |
" }\n", | |
"\n", | |
" .dataframe tbody tr th {\n", | |
" vertical-align: top;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead th {\n", | |
" text-align: right;\n", | |
" }\n", | |
"</style>\n", | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr style=\"text-align: right;\">\n", | |
" <th></th>\n", | |
" <th>Country</th>\n", | |
" <th>Confirmed</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>5</th>\n", | |
" <td>China</td>\n", | |
" <td>372405</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>18</th>\n", | |
" <td>Others</td>\n", | |
" <td>456</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>21</th>\n", | |
" <td>Singapore</td>\n", | |
" <td>398</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>27</th>\n", | |
" <td>Thailand</td>\n", | |
" <td>380</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>9</th>\n", | |
" <td>Hong Kong</td>\n", | |
" <td>349</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>13</th>\n", | |
" <td>Japan</td>\n", | |
" <td>338</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>22</th>\n", | |
" <td>South Korea</td>\n", | |
" <td>273</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>26</th>\n", | |
" <td>Taiwan</td>\n", | |
" <td>206</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>0</th>\n", | |
" <td>Australia</td>\n", | |
" <td>194</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>15</th>\n", | |
" <td>Malaysia</td>\n", | |
" <td>181</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>29</th>\n", | |
" <td>US</td>\n", | |
" <td>162</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>8</th>\n", | |
" <td>Germany</td>\n", | |
" <td>156</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>14</th>\n", | |
" <td>Macau</td>\n", | |
" <td>149</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>31</th>\n", | |
" <td>Vietnam</td>\n", | |
" <td>130</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>7</th>\n", | |
" <td>France</td>\n", | |
" <td>117</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>30</th>\n", | |
" <td>United Arab Emirates</td>\n", | |
" <td>76</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>4</th>\n", | |
" <td>Canada</td>\n", | |
" <td>73</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>28</th>\n", | |
" <td>UK</td>\n", | |
" <td>39</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>10</th>\n", | |
" <td>India</td>\n", | |
" <td>32</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>11</th>\n", | |
" <td>Italy</td>\n", | |
" <td>31</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>19</th>\n", | |
" <td>Philippines</td>\n", | |
" <td>29</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>20</th>\n", | |
" <td>Russia</td>\n", | |
" <td>24</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>17</th>\n", | |
" <td>Nepal</td>\n", | |
" <td>18</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>24</th>\n", | |
" <td>Sri Lanka</td>\n", | |
" <td>16</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>3</th>\n", | |
" <td>Cambodia</td>\n", | |
" <td>16</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>23</th>\n", | |
" <td>Spain</td>\n", | |
" <td>15</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>6</th>\n", | |
" <td>Finland</td>\n", | |
" <td>14</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>25</th>\n", | |
" <td>Sweden</td>\n", | |
" <td>12</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>1</th>\n", | |
" <td>Belgium</td>\n", | |
" <td>8</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>12</th>\n", | |
" <td>Ivory Coast</td>\n", | |
" <td>0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2</th>\n", | |
" <td>Brazil</td>\n", | |
" <td>0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>16</th>\n", | |
" <td>Mexico</td>\n", | |
" <td>0</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" Country Confirmed\n", | |
"5 China 372405\n", | |
"18 Others 456\n", | |
"21 Singapore 398\n", | |
"27 Thailand 380\n", | |
"9 Hong Kong 349\n", | |
"13 Japan 338\n", | |
"22 South Korea 273\n", | |
"26 Taiwan 206\n", | |
"0 Australia 194\n", | |
"15 Malaysia 181\n", | |
"29 US 162\n", | |
"8 Germany 156\n", | |
"14 Macau 149\n", | |
"31 Vietnam 130\n", | |
"7 France 117\n", | |
"30 United Arab Emirates 76\n", | |
"4 Canada 73\n", | |
"28 UK 39\n", | |
"10 India 32\n", | |
"11 Italy 31\n", | |
"19 Philippines 29\n", | |
"20 Russia 24\n", | |
"17 Nepal 18\n", | |
"24 Sri Lanka 16\n", | |
"3 Cambodia 16\n", | |
"23 Spain 15\n", | |
"6 Finland 14\n", | |
"25 Sweden 12\n", | |
"1 Belgium 8\n", | |
"12 Ivory Coast 0\n", | |
"2 Brazil 0\n", | |
"16 Mexico 0" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"# Total number of cases\n", | |
"\n", | |
"print(\"\\nTotal number of confirmed cases: \", df['Confirmed'].sum(), \"\\n\")\n", | |
"\n", | |
"# Group the rows by their country and sum the values of the confirmed cases per country\n", | |
"\n", | |
"df_country = df.groupby(['Country'])['Confirmed'].sum().reset_index()\n", | |
"\n", | |
"# Put the result in a dataframe\n", | |
"\n", | |
"df_country = pd.DataFrame(df_country)\n", | |
"\n", | |
"# Sort the values\n", | |
"display(df_country.sort_values('Confirmed', ascending=False))" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.7.2" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment