For more information on COVID-19, please check out this World Health Organization FAQ. It is a fantastic resource to educate yourself.
We will be running this notebook every day until we truly "flatten the curve".
from bs4 import BeautifulSoup as soup
from urllib.request import Request, urlopen
from datetime import date, datetime
fname = 'https://www.worldometers.info/coronavirus/'
req = Request(fname, headers={'User-Agent': 'Mozilla/5.0'})
webpage = urlopen(req)
page_soup = soup(webpage, "html.parser")
today = datetime.now()
now_str = "%s %d, %d at %d:%s" % (date.today().strftime("%b"), today.day, today.year, today.hour, '0'+str(today.minute) if today.minute < 10 else str(today.minute))
containers = page_soup.findAll("div", {"class": "maincounter-number"})
print("As of %s UTC, there have been %s total COVID-19 cases." % (now_str, containers[0].findAll("span")[0].text.replace(' ', '')))
As of Jul 2, 2021 at 19:48 UTC, there have been 183,832,496 total COVID-19 cases.
Here's an updated template of imports that we use. Note the two integer variables at the bottom of this code block, LOOK_AT and AT_LEAST. LOOK_AT controls how many bars the user can see in the bar graph, and AT_LEAST controls what rank a country must be in terms of total cases shown on the bar graph. That should become more clear in the visualizations towards the end of the notebook.
#-----General------#
import numpy as np
import pandas as pd
import os
import sys
import math
import random
#-----Plotting-----#
import matplotlib.pyplot as plt
import plotly.graph_objects as go
import plotly.express as px
import plotly.offline as py
py.init_notebook_mode(connected=True)
import seaborn as sns
from pandas_profiling import ProfileReport
#-----Utility-----#
import itertools
import warnings
warnings.filterwarnings("ignore")
import re
import gc
from bs4 import BeautifulSoup as soup
from urllib.request import Request, urlopen
from datetime import date, datetime
LOOK_AT = 5 # Controls how many bars the user can see in the bar graph
AT_LEAST = 50 # Controls what rank a country must be in terms of total cases to be shown on the bar graph
fname = 'https://www.worldometers.info/coronavirus/#countries'
req = Request(fname, headers={'User-Agent': 'Mozilla/5.0'})
webpage = urlopen(req)
page_soup = soup(webpage, "html.parser")
today = datetime.now()
today_str = "%s %d, %d" % (date.today().strftime("%b"), today.day, today.year)
yesterday_str = "%s %d, %d" % (date.today().strftime("%b"), today.day-1, today.year)
clean = True
print("This version of the notebook is being run on %s." % today_str)
This version of the notebook is being run on Jul 2, 2021.
If clean is set to true, the numerical data will be converted from a string to float. We drop China in our analysis because of some inconsistent positioning for China when scraping the da
table = page_soup.findAll("table", {"id": "main_table_countries_yesterday"})
containers = table[0].findAll("tr", {"style": ""})
del containers[0]
all_data = []
for country in containers:
country_data = []
country_container = country.findAll("td")
if country_container[1].text == 'China':
continue
for i in range(1, len(country_container)):
final_feature = country_container[i].text
if clean:
if i != 1 and i != len(country_container)-1:
final_feature = final_feature.replace(',', '')
if final_feature.find('+') != -1:
final_feature = final_feature.replace('+', '')
final_feature = float(final_feature)
elif final_feature.find('-') != -1:
final_feature = final_feature.replace('-', '')
final_feature = float(final_feature)*-1
if final_feature == 'N/A':
final_feature = 0
elif final_feature == '' or final_feature == ' ':
final_feature = -1 #None
country_data.append(final_feature)
all_data.append(country_data)
df = pd.DataFrame(all_data)
df = df.drop([i for i in range(15, len(all_data[0]))], axis=1) # Get rid of unnecessary data
On the worldometers website, the category "New Recovered" doesn't appear; however, based on the numbers, we can interpolate a certain column of data to be that.
column_labels = ["Country", "Total Cases", "New Cases", "Total Deaths", "New Deaths", "Total Recovered", "New Recovered", "Active Cases", "Serious/Critical",
"Tot Cases/1M", "Deaths/1M", "Total Tests", "Tests/1M", "Population", "Continent"]
df.columns = column_labels
For some reason, some countries are not included when scraping the web page.
country_labels = page_soup.findAll("a", {"class": "mt_a"})
c_label = []
for country in country_labels:
c_label.append(country.text)
c_label = set(c_label)
not_counted = []
sorted_countries = set(df['Country']) #Increase computational speed
for country in c_label:
if country not in sorted_countries:
not_counted.append(country)
print(not_counted + ['China'])
['Montserrat', 'Greenland', 'Anguilla', 'Solomon Islands', 'Falkland Islands', 'Saint Pierre Miquelon', 'Antigua and Barbuda', 'Vatican City', 'Saint Helena', 'Vanuatu', 'Marshall Islands', 'Grenada', 'Samoa', 'Wallis and Futuna', 'China', 'Micronesia', 'China']
Here, we will convert all the numerical data into np.int64 data type, and add some other features that may be particularly useful.
for label in df.columns:
if label != 'Country' and label != 'Continent':
df[label] = pd.to_numeric(df[label])
df['%Inc Cases'] = df['New Cases']/df['Total Cases']*100
df['%Inc Deaths'] = df['New Deaths']/df['Total Deaths']*100
df['%Inc Recovered'] = df['New Recovered']/df['Total Recovered']*100
pd.options.display.max_rows = None
df
| Country | Total Cases | New Cases | Total Deaths | New Deaths | Total Recovered | New Recovered | Active Cases | Serious/Critical | Tot Cases/1M | Deaths/1M | Total Tests | Tests/1M | Population | Continent | %Inc Cases | %Inc Deaths | %Inc Recovered | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | World | 183401218 | 432413.0 | 3971191 | 8320.0 | 167909780 | 362543.0 | 11520247 | 78708 | 23529.0 | 509.5 | -1 | -1 | -1 | All | 0.235774 | 0.209509 | 0.215915 |
| 1 | USA | 34561607 | 17153.0 | 620657 | 319.0 | 29052087 | 25399.0 | 4888863 | 3868 | 103806.0 | 1864.0 | 506604612 | 1521587 | 332944930 | North America | 0.049630 | 0.051397 | 0.087426 |
| 2 | India | 30453937 | 43360.0 | 400271 | 796.0 | 29536087 | 54565.0 | 517579 | 8944 | 21853.0 | 287.0 | 412021494 | 295659 | 1393568297 | Asia | 0.142379 | 0.198865 | 0.184740 |
| 3 | Brazil | 18622304 | 63140.0 | 520189 | 1943.0 | 16931272 | 72640.0 | 1170843 | 8318 | 86991.0 | 2430.0 | 53209627 | 248561 | 214070952 | South America | 0.339056 | 0.373518 | 0.429029 |
| 4 | France | 5777965 | 2664.0 | 111111 | 29.0 | 5622756 | 3846.0 | 44098 | 1162 | 88324.0 | 1698.0 | 93465436 | 1428738 | 65418158 | Europe | 0.046106 | 0.026100 | 0.068401 |
| 5 | Russia | 5538142 | 23543.0 | 135886 | 672.0 | 5017321 | 16928.0 | 384935 | 2300 | 37933.0 | 931.0 | 150121327 | 1028248 | 145997153 | Europe | 0.425106 | 0.494532 | 0.337391 |
| 6 | Turkey | 5430940 | 5288.0 | 49774 | 42.0 | 5300504 | 6219.0 | 80662 | 706 | 63709.0 | 584.0 | 61012512 | 715722 | 85246138 | Asia | 0.097368 | 0.084381 | 0.117328 |
| 7 | UK | 4828044 | 27850.0 | 128162 | 22.0 | 4327556 | 2680.0 | 372326 | 287 | 70748.0 | 1878.0 | 213530473 | 3128977 | 68242904 | Europe | 0.576838 | 0.017166 | 0.061929 |
| 8 | Argentina | 4491551 | 21177.0 | 94772 | 468.0 | 4092053 | 15132.0 | 304726 | 6046 | 98476.0 | 2078.0 | 16798807 | 368310 | 45610453 | South America | 0.471485 | 0.493817 | 0.369790 |
| 9 | Colombia | 4269297 | 28315.0 | 107137 | 593.0 | 3964074 | 27918.0 | 198086 | 8155 | 83020.0 | 2083.0 | 20060182 | 390086 | 51424973 | South America | 0.663224 | 0.553497 | 0.704275 |
| 10 | Italy | 4260788 | 882.0 | 127587 | 21.0 | 4083843 | 1941.0 | 49358 | 229 | 70575.0 | 2113.0 | 71771680 | 1188810 | 60372723 | Europe | 0.020700 | 0.016459 | 0.047529 |
| 11 | Spain | 3821305 | 12345.0 | 80883 | 8.0 | 3603584 | 3860.0 | 136838 | 584 | 81699.0 | 1729.0 | 52691812 | 1126545 | 46772921 | Europe | 0.323057 | 0.009891 | 0.107116 |
| 12 | Germany | 3736940 | 717.0 | 91530 | 71.0 | 3625700 | 1500.0 | 19710 | 736 | 44460.0 | 1089.0 | 63813168 | 759209 | 84052180 | Europe | 0.019187 | 0.077570 | 0.041371 |
| 13 | Iran | 3218860 | 14303.0 | 84389 | 125.0 | 2889939 | 13111.0 | 244532 | 3187 | 37839.0 | 992.0 | 23308926 | 274007 | 85066920 | Asia | 0.444350 | 0.148124 | 0.453677 |
| 14 | Poland | 2880011 | 99.0 | 75044 | 23.0 | 2651906 | 119.0 | 153061 | 130 | 76181.0 | 1985.0 | 17444955 | 461445 | 37805071 | Europe | 0.003437 | 0.030649 | 0.004487 |
| 15 | Mexico | 2519269 | 6105.0 | 233047 | 244.0 | 2000530 | 3149.0 | 285692 | 4798 | 19336.0 | 1789.0 | 7507730 | 57625 | 130286775 | North America | 0.242332 | 0.104700 | 0.157408 |
| 16 | Ukraine | 2235801 | 705.0 | 52391 | 51.0 | 2168387 | 1719.0 | 15023 | 177 | 51433.0 | 1205.0 | 10861246 | 249855 | 43470207 | Europe | 0.031532 | 0.097345 | 0.079276 |
| 17 | Indonesia | 2203108 | 24836.0 | 58995 | 504.0 | 1890287 | 9874.0 | 253826 | -1 | 7970.0 | 213.0 | 20079271 | 72642 | 276414625 | Asia | 1.127317 | 0.854310 | 0.522355 |
| 18 | Peru | 2057554 | 3079.0 | 192687 | 122.0 | 0 | 0.0 | 0 | 2346 | 61547.0 | 5764.0 | 14224136 | 425483 | 33430551 | South America | 0.149644 | 0.063315 | NaN |
| 19 | South Africa | 1995556 | 21584.0 | 61029 | 382.0 | 1754793 | 6751.0 | 179734 | 546 | 33228.0 | 1016.0 | 13209499 | 219954 | 60055730 | Africa | 1.081603 | 0.625932 | 0.384718 |
| 20 | Netherlands | 1685825 | 825.0 | 17748 | 3.0 | 1634035 | 2320.0 | 34042 | 126 | 98168.0 | 1033.0 | 14730069 | 857754 | 17172841 | Europe | 0.048937 | 0.016903 | 0.141980 |
| 21 | Czechia | 1667444 | 137.0 | 30307 | 1.0 | 1635727 | 16.0 | 1410 | 11 | 155416.0 | 2825.0 | 29875529 | 2784590 | 10728879 | Europe | 0.008216 | 0.003300 | 0.000978 |
| 22 | Chile | 1558557 | 2655.0 | 32588 | 43.0 | 1502411 | 8127.0 | 23558 | 2943 | 80837.0 | 1690.0 | 17012734 | 882390 | 19280298 | South America | 0.170350 | 0.131950 | 0.540931 |
| 23 | Philippines | 1418326 | 5784.0 | 24796 | 134.0 | 1341851 | 2737.0 | 51679 | 1957 | 12773.0 | 223.0 | 14988187 | 134983 | 111037892 | Asia | 0.407805 | 0.540410 | 0.203972 |
| 24 | Canada | 1415310 | 26.0 | 26295 | -1.0 | 1381943 | 41.0 | 7072 | 466 | 37174.0 | 691.0 | 36768392 | 965732 | 38073065 | North America | 0.001837 | -0.003803 | 0.002967 |
| 25 | Iraq | 1353458 | 7554.0 | 17216 | 30.0 | 1250121 | 4593.0 | 86121 | 633 | 32913.0 | 419.0 | 11771294 | 286254 | 41121807 | Asia | 0.558126 | 0.174257 | 0.367404 |
| 26 | Sweden | 1090880 | 328.0 | 14592 | -1.0 | 1061185 | 2786.0 | 15103 | 41 | 107346.0 | 1436.0 | 10828578 | 1065566 | 10162275 | Europe | 0.030067 | -0.006853 | 0.262537 |
| 27 | Belgium | 1085131 | 581.0 | 25173 | 3.0 | 1036831 | 799.0 | 23127 | 143 | 93223.0 | 2163.0 | 15270322 | 1311871 | 11640113 | Europe | 0.053542 | 0.011918 | 0.077062 |
| 28 | Romania | 1080823 | 31.0 | 33897 | 5.0 | 1045351 | -1.0 | 1575 | 67 | 56561.0 | 1774.0 | 9831916 | 514519 | 19108946 | Europe | 0.002868 | 0.014751 | -0.000096 |
| 29 | Pakistan | 958408 | 1037.0 | 22321 | 40.0 | 904320 | 836.0 | 31767 | 1844 | 4256.0 | 99.0 | 14590230 | 64797 | 225169489 | Asia | 0.108200 | 0.179203 | 0.092445 |
| 30 | Bangladesh | 921559 | 8301.0 | 14646 | 143.0 | 820913 | 4663.0 | 86000 | 1192 | 5541.0 | 88.0 | 6640982 | 39927 | 166329638 | Asia | 0.900756 | 0.976376 | 0.568026 |
| 31 | Portugal | 882006 | 2449.0 | 17101 | 5.0 | 830224 | 1234.0 | 34681 | 113 | 86753.0 | 1682.0 | 13332860 | 1311398 | 10166903 | Europe | 0.277663 | 0.029238 | 0.148635 |
| 32 | Israel | 842067 | 290.0 | 6429 | -1.0 | 833600 | 134.0 | 2038 | 27 | 90292.0 | 689.0 | 15091313 | 1618198 | 9326000 | Asia | 0.034439 | -0.015555 | 0.016075 |
| 33 | Hungary | 808160 | 32.0 | 29992 | -1.0 | 739204 | 422.0 | 38964 | 20 | 83871.0 | 3113.0 | 6138529 | 637057 | 9635762 | Europe | 0.003960 | -0.003334 | 0.057088 |
| 34 | Japan | 799975 | 1816.0 | 14781 | 41.0 | 768328 | 1712.0 | 16866 | 517 | 6345.0 | 117.0 | 16445549 | 130429 | 126088301 | Asia | 0.227007 | 0.277383 | 0.222822 |
| 35 | Malaysia | 758967 | 6988.0 | 5254 | 84.0 | 688260 | 5580.0 | 65453 | 917 | 23153.0 | 160.0 | 14645806 | 446787 | 32780259 | Asia | 0.920725 | 1.598782 | 0.810740 |
| 36 | Jordan | 751937 | 533.0 | 9756 | 6.0 | 735610 | 516.0 | 6571 | 467 | 72972.0 | 947.0 | 7892481 | 765934 | 10304394 | Asia | 0.070884 | 0.061501 | 0.070146 |
| 37 | Serbia | 716643 | 81.0 | 7047 | -1.0 | 707706 | 115.0 | 1890 | 13 | 82353.0 | 810.0 | 4422502 | 508212 | 8702081 | Europe | 0.011303 | -0.014190 | 0.016250 |
| 38 | Switzerland | 703176 | 172.0 | 10894 | 3.0 | 684621 | 756.0 | 7661 | 39 | 80659.0 | 1250.0 | 8329750 | 955473 | 8717935 | Europe | 0.024460 | 0.027538 | 0.110426 |
| 39 | Austria | 650474 | 62.0 | 10706 | 4.0 | 637909 | 158.0 | 1859 | 52 | 71814.0 | 1182.0 | 55451224 | 6121916 | 9057822 | Europe | 0.009532 | 0.037362 | 0.024768 |
| 40 | Nepal | 640662 | 1857.0 | 9145 | 33.0 | 600149 | 4017.0 | 31368 | -1 | 21600.0 | 308.0 | 3351263 | 112991 | 29659603 | Asia | 0.289856 | 0.360853 | 0.669334 |
| 41 | UAE | 634582 | 1675.0 | 1819 | 8.0 | 612998 | 1556.0 | 19765 | -1 | 63396.0 | 182.0 | 58026680 | 5796988 | 10009799 | Asia | 0.263953 | 0.439802 | 0.253834 |
| 42 | Lebanon | 545016 | 150.0 | 7854 | 3.0 | 532776 | 239.0 | 4386 | 54 | 80211.0 | 1156.0 | 4731376 | 696324 | 6794794 | Asia | 0.027522 | 0.038197 | 0.044859 |
| 43 | Morocco | 532150 | 789.0 | 9298 | 2.0 | 518101 | 525.0 | 4751 | 154 | 14249.0 | 249.0 | 6854680 | 183537 | 37347713 | Africa | 0.148266 | 0.021510 | 0.101332 |
| 44 | Saudi Arabia | 489126 | 1534.0 | 7832 | 13.0 | 469120 | 1487.0 | 12174 | 1389 | 13835.0 | 222.0 | 22008712 | 622505 | 35355097 | Asia | 0.313621 | 0.165986 | 0.316976 |
| 45 | Ecuador | 459538 | 1034.0 | 21605 | 45.0 | 423688 | -1.0 | 14245 | 421 | 25657.0 | 1206.0 | 1550222 | 86554 | 17910520 | South America | 0.225009 | 0.208285 | -0.000236 |
| 46 | Bolivia | 439624 | 2001.0 | 16767 | 65.0 | 360926 | 2075.0 | 61931 | 200 | 37155.0 | 1417.0 | 1826165 | 154341 | 11832052 | South America | 0.455162 | 0.387666 | 0.574910 |
| 47 | Tunisia | 426879 | 6776.0 | 15065 | 106.0 | 356321 | 1880.0 | 55493 | 526 | 35745.0 | 1261.0 | 1737467 | 145489 | 11942232 | Africa | 1.587335 | 0.703618 | 0.527614 |
| 48 | Kazakhstan | 425573 | 2436.0 | 4375 | 26.0 | 396396 | 1134.0 | 24802 | 221 | 22397.0 | 230.0 | 11575012 | 609175 | 19001121 | Asia | 0.572405 | 0.594286 | 0.286078 |
| 49 | Paraguay | 424998 | 1716.0 | 13017 | 122.0 | 373253 | 2598.0 | 38728 | 568 | 58863.0 | 1803.0 | 1537487 | 212946 | 7220073 | South America | 0.403767 | 0.937236 | 0.696043 |
| 50 | Greece | 423185 | 729.0 | 12691 | 4.0 | 405408 | 378.0 | 5086 | 189 | 40801.0 | 1224.0 | 10674006 | 1029118 | 10371995 | Europe | 0.172265 | 0.031518 | 0.093239 |
| 51 | Bulgaria | 421902 | 73.0 | 18067 | 6.0 | 394930 | 273.0 | 8905 | 163 | 61181.0 | 2620.0 | 3206721 | 465014 | 6895962 | Europe | 0.017303 | 0.033210 | 0.069126 |
| 52 | Belarus | 418212 | 1023.0 | 3153 | 10.0 | 410984 | 1187.0 | 4075 | -1 | 44273.0 | 334.0 | 6813944 | 721342 | 9446209 | Europe | 0.244613 | 0.317158 | 0.288819 |
| 53 | Panama | 404983 | 1205.0 | 6552 | 7.0 | 385671 | 968.0 | 12760 | 84 | 92408.0 | 1495.0 | 3012379 | 687355 | 4382567 | North America | 0.297543 | 0.106838 | 0.250991 |
| 54 | Slovakia | 391659 | 17.0 | 12511 | 1.0 | 378700 | 61.0 | 448 | 26 | 71702.0 | 2290.0 | 2964856 | 542786 | 5462291 | Europe | 0.004341 | 0.007993 | 0.016108 |
| 55 | Uruguay | 370600 | 1250.0 | 5619 | 26.0 | 350291 | 1802.0 | 14690 | 251 | 106318.0 | 1612.0 | 2815347 | 807666 | 3485783 | South America | 0.337291 | 0.462716 | 0.514429 |
| 56 | Costa Rica | 369540 | 1602.0 | 4674 | 7.0 | 294872 | 1340.0 | 69994 | 398 | 71886.0 | 909.0 | 1489540 | 289758 | 5140630 | North America | 0.433512 | 0.149765 | 0.454434 |
| 57 | Georgia | 367058 | 980.0 | 5327 | 11.0 | 352624 | 877.0 | 9107 | -1 | 92191.0 | 1338.0 | 5847116 | 1468574 | 3981492 | Asia | 0.266988 | 0.206495 | 0.248707 |
| 58 | Croatia | 359975 | 103.0 | 8209 | 3.0 | 351241 | 71.0 | 525 | 13 | 88232.0 | 2012.0 | 2153014 | 527716 | 4079872 | Europe | 0.028613 | 0.036545 | 0.020214 |
| 59 | Kuwait | 358511 | 1824.0 | 1979 | 10.0 | 337829 | 1707.0 | 18703 | 294 | 82728.0 | 457.0 | 2992536 | 690538 | 4333631 | Asia | 0.508771 | 0.505306 | 0.505285 |
| 60 | Azerbaijan | 336122 | 75.0 | 4975 | 1.0 | 330275 | 56.0 | 872 | -1 | 32855.0 | 486.0 | 3758131 | 367344 | 10230559 | Asia | 0.022313 | 0.020101 | 0.016956 |
| 61 | Dominican Republic | 326193 | 972.0 | 3840 | 18.0 | 267396 | 1317.0 | 54957 | 372 | 29771.0 | 350.0 | 1717949 | 156795 | 10956658 | North America | 0.297983 | 0.468750 | 0.492528 |
| 62 | Palestine | 314288 | 121.0 | 3565 | 2.0 | 308303 | 117.0 | 2420 | 7 | 60214.0 | 683.0 | 1904455 | 364870 | 5219545 | Asia | 0.038500 | 0.056101 | 0.037950 |
| 63 | Guatemala | 296438 | 2855.0 | 9282 | 67.0 | 265352 | 926.0 | 21804 | 5 | 16247.0 | 509.0 | 1590968 | 87195 | 18246132 | North America | 0.963102 | 0.721827 | 0.348970 |
| 64 | Denmark | 294152 | 475.0 | 2535 | 1.0 | 288476 | 286.0 | 3141 | 12 | 50606.0 | 436.0 | 68936564 | 11859801 | 5812624 | Europe | 0.161481 | 0.039448 | 0.099142 |
| 65 | Egypt | 281524 | 242.0 | 16194 | 25.0 | 212059 | 675.0 | 53271 | 90 | 2700.0 | 155.0 | 2869589 | 27524 | 104259426 | Africa | 0.085961 | 0.154378 | 0.318308 |
| 66 | Lithuania | 278796 | 12.0 | 4386 | 3.0 | 267721 | 98.0 | 6689 | 45 | 103868.0 | 1634.0 | 3769808 | 1404478 | 2684134 | Europe | 0.004304 | 0.068399 | 0.036605 |
| 67 | Ethiopia | 276250 | 76.0 | 4325 | 5.0 | 260737 | 365.0 | 11188 | 142 | 2345.0 | 37.0 | 2871470 | 24376 | 117799051 | Africa | 0.027511 | 0.115607 | 0.139988 |
| 68 | Venezuela | 274024 | 1312.0 | 3136 | 17.0 | 255256 | 1310.0 | 15632 | 356 | 9664.0 | 111.0 | 3359014 | 118462 | 28355170 | South America | 0.478790 | 0.542092 | 0.513210 |
| 69 | Ireland | 272784 | 448.0 | 5000 | 11.0 | 257330 | 715.0 | 10454 | 14 | 54634.0 | 1001.0 | 4729538 | 947251 | 4992909 | Europe | 0.164233 | 0.220000 | 0.277853 |
| 70 | Oman | 270504 | 1959.0 | 3140 | 40.0 | 236988 | 2127.0 | 30376 | 530 | 51663.0 | 600.0 | 1550000 | 296032 | 5235920 | Asia | 0.724204 | 1.273885 | 0.897514 |
| 71 | Bahrain | 265975 | 148.0 | 1353 | 1.0 | 261740 | 453.0 | 2882 | 85 | 151096.0 | 769.0 | 5052499 | 2870247 | 1760301 | Asia | 0.055644 | 0.073910 | 0.173073 |
| 72 | Thailand | 264834 | 5533.0 | 2080 | 57.0 | 210702 | 3223.0 | 52052 | 1971 | 3785.0 | 30.0 | 8129670 | 116179 | 69975371 | Asia | 2.089233 | 2.740385 | 1.529649 |
| 73 | Honduras | 262760 | 691.0 | 7005 | 25.0 | 92454 | 51.0 | 163301 | 566 | 26114.0 | 696.0 | 792602 | 78773 | 10061846 | North America | 0.262978 | 0.356888 | 0.055163 |
| 74 | Sri Lanka | 260972 | 1883.0 | 3120 | 43.0 | 227840 | 1888.0 | 30012 | -1 | 12136.0 | 145.0 | 3743577 | 174095 | 21503126 | Asia | 0.721533 | 1.378205 | 0.828652 |
| 75 | Slovenia | 257358 | 23.0 | 4419 | -1.0 | 252368 | 83.0 | 571 | 16 | 123776.0 | 2125.0 | 1348941 | 648771 | 2079224 | Europe | 0.008937 | -0.022630 | 0.032888 |
| 76 | Moldova | 256816 | 82.0 | 6194 | -1.0 | 249774 | 68.0 | 848 | 53 | 63812.0 | 1539.0 | 1266454 | 314681 | 4024565 | Europe | 0.031929 | -0.016145 | 0.027225 |
| 77 | Armenia | 225221 | 126.0 | 4517 | 3.0 | 216882 | 104.0 | 3822 | -1 | 75863.0 | 1521.0 | 1188922 | 400474 | 2968790 | Asia | 0.055945 | 0.066416 | 0.047952 |
| 78 | Qatar | 222217 | 146.0 | 591 | 1.0 | 219985 | 186.0 | 1641 | 50 | 79143.0 | 210.0 | 2172413 | 773705 | 2807805 | Asia | 0.065702 | 0.169205 | 0.084551 |
| 79 | Bosnia and Herzegovina | 205032 | 10.0 | 9667 | 2.0 | 183534 | 228.0 | 11831 | -1 | 62887.0 | 2965.0 | 1032106 | 316563 | 3260348 | Europe | 0.004877 | 0.020689 | 0.124228 |
| 80 | Cuba | 193945 | 2952.0 | 1302 | 18.0 | 176030 | 1879.0 | 16613 | 184 | 17133.0 | 115.0 | 5149286 | 454896 | 11319688 | North America | 1.522081 | 1.382488 | 1.067432 |
| 81 | Libya | 193905 | 431.0 | 3198 | 5.0 | 178621 | 234.0 | 12086 | -1 | 27841.0 | 459.0 | 1123702 | 161344 | 6964614 | Africa | 0.222274 | 0.156348 | 0.131004 |
| 82 | Kenya | 184537 | 376.0 | 3640 | 6.0 | 126594 | 910.0 | 54303 | 113 | 3358.0 | 66.0 | 1963532 | 35732 | 54951562 | Africa | 0.203753 | 0.164835 | 0.718833 |
| 83 | Nigeria | 167692 | 74.0 | 2121 | 1.0 | 164273 | 29.0 | 1298 | 11 | 794.0 | 10.0 | 2300266 | 10890 | 211226874 | Africa | 0.044129 | 0.047148 | 0.017654 |
| 84 | Myanmar | 159347 | 2070.0 | 3347 | 13.0 | 136992 | 549.0 | 19008 | -1 | 2909.0 | 61.0 | 2743783 | 50092 | 54774726 | Asia | 1.299052 | 0.388408 | 0.400753 |
| 85 | Zambia | 157832 | 2884.0 | 2271 | 72.0 | 134419 | 2627.0 | 21142 | 1307 | 8353.0 | 120.0 | 1885589 | 99787 | 18896140 | Africa | 1.827259 | 3.170410 | 1.954337 |
| 86 | S. Korea | 157723 | 762.0 | 2021 | 3.0 | 148024 | 331.0 | 7678 | 144 | 3074.0 | 39.0 | 10614317 | 206853 | 51313385 | Asia | 0.483125 | 0.148441 | 0.223612 |
| 87 | North Macedonia | 155689 | 5.0 | 5485 | 1.0 | 150063 | 86.0 | 141 | 25 | 74732.0 | 2633.0 | 881870 | 423307 | 2083288 | Europe | 0.003212 | 0.018232 | 0.057309 |
| 88 | Algeria | 140075 | 449.0 | 3726 | 10.0 | 97380 | 291.0 | 38969 | 28 | 3138.0 | 83.0 | 230861 | 5172 | 44640962 | Africa | 0.320543 | 0.268384 | 0.298829 |
| 89 | Latvia | 137500 | 71.0 | 2520 | 7.0 | 134062 | 134.0 | 918 | 30 | 73716.0 | 1351.0 | 2915159 | 1562869 | 1865261 | Europe | 0.051636 | 0.277778 | 0.099954 |
| 90 | Albania | 132523 | 2.0 | 2456 | -1.0 | 130014 | 5.0 | 53 | 3 | 46101.0 | 854.0 | 809570 | 281624 | 2874648 | Europe | 0.001509 | -0.040717 | 0.003846 |
| 91 | Norway | 131509 | 193.0 | 794 | -1.0 | 88952 | -1.0 | 41763 | 7 | 24070.0 | 145.0 | 6148762 | 1125396 | 5463641 | Europe | 0.146758 | -0.125945 | -0.001124 |
| 92 | Estonia | 131084 | 20.0 | 1269 | -1.0 | 127416 | 65.0 | 2399 | 6 | 98750.0 | 956.0 | 1529148 | 1151962 | 1327429 | Europe | 0.015257 | -0.078802 | 0.051014 |
| 93 | Kyrgyzstan | 126395 | 1392.0 | 2009 | 9.0 | 110698 | 616.0 | 13688 | 102 | 19059.0 | 303.0 | 1310251 | 197576 | 6631619 | Asia | 1.101309 | 0.447984 | 0.556469 |
| 94 | Afghanistan | 122156 | 1940.0 | 5048 | 86.0 | 71924 | 912.0 | 45184 | 1124 | 3069.0 | 127.0 | 617618 | 15517 | 39801850 | Asia | 1.588133 | 1.703645 | 1.268005 |
| 95 | Mongolia | 117963 | 2485.0 | 578 | 15.0 | 79256 | 2602.0 | 38129 | 126 | 35414.0 | 174.0 | 3266128 | 980530 | 3330983 | Asia | 2.106593 | 2.595156 | 3.283032 |
| 96 | Uzbekistan | 111153 | 476.0 | 740 | 4.0 | 107696 | 633.0 | 2717 | 23 | 3274.0 | 22.0 | 1377915 | 40582 | 33953552 | Asia | 0.428239 | 0.540541 | 0.587766 |
| 97 | Montenegro | 100272 | 20.0 | 1613 | -1.0 | 98371 | 19.0 | 288 | 6 | 159632.0 | 2568.0 | 452318 | 720084 | 628146 | Europe | 0.019946 | -0.061996 | 0.019315 |
| 98 | Finland | 95964 | 222.0 | 973 | -1.0 | 46000 | -1.0 | 48991 | 7 | 17293.0 | 175.0 | 5442313 | 980713 | 5549341 | Europe | 0.231337 | -0.102775 | -0.002174 |
| 99 | Ghana | 95914 | -1.0 | 796 | -1.0 | 93444 | -1.0 | 1674 | 9 | 3024.0 | 25.0 | 1276266 | 40236 | 31719480 | Africa | -0.001043 | -0.125628 | -0.001070 |
| 100 | Namibia | 91208 | 1291.0 | 1556 | 35.0 | 67780 | 450.0 | 21872 | 81 | 35259.0 | 602.0 | 532519 | 205859 | 2586808 | Africa | 1.415446 | 2.249357 | 0.663913 |
| 101 | Uganda | 81034 | 1057.0 | 1061 | 38.0 | 53551 | 590.0 | 26422 | 1081 | 1718.0 | 22.0 | 1333486 | 28266 | 47176599 | Africa | 1.304391 | 3.581527 | 1.101753 |
| 102 | Cameroon | 80858 | -1.0 | 1324 | -1.0 | 78224 | -1.0 | 1310 | 152 | 2972.0 | 49.0 | 1751774 | 64394 | 27203797 | Africa | -0.001237 | -0.075529 | -0.001278 |
| 103 | El Salvador | 78766 | -1.0 | 2387 | 6.0 | 72572 | -1.0 | 3807 | 54 | 12083.0 | 366.0 | 1062066 | 162920 | 6518960 | North America | -0.001270 | 0.251362 | -0.001378 |
| 104 | Mozambique | 77205 | 801.0 | 884 | 6.0 | 71491 | 286.0 | 4830 | 32 | 2403.0 | 28.0 | 600704 | 18698 | 32126557 | Africa | 1.037498 | 0.678733 | 0.400050 |
| 105 | Cyprus | 76333 | 473.0 | 374 | -1.0 | 72681 | 59.0 | 3278 | 18 | 62766.0 | 308.0 | 7879677 | 6479193 | 1216151 | Asia | 0.619653 | -0.267380 | 0.081177 |
| 106 | Maldives | 73931 | 133.0 | 213 | 3.0 | 70325 | 351.0 | 3393 | 90 | 134410.0 | 387.0 | 1018818 | 1852255 | 550042 | Asia | 0.179897 | 1.408451 | 0.499111 |
| 107 | Botswana | 71443 | 1763.0 | 1158 | 33.0 | 66323 | 2391.0 | 3962 | 1 | 29781.0 | 483.0 | 1321854 | 551010 | 2398966 | Africa | 2.467702 | 2.849741 | 3.605084 |
| 108 | Luxembourg | 70895 | 108.0 | 818 | -1.0 | 69726 | 20.0 | 351 | 1 | 111445.0 | 1286.0 | 3089693 | 4856923 | 636142 | Europe | 0.152338 | -0.122249 | 0.028684 |
| 109 | Singapore | 62589 | 10.0 | 36 | -1.0 | 62234 | 6.0 | 319 | 3 | 10615.0 | 6.0 | 13607805 | 2307831 | 5896362 | Asia | 0.015977 | -2.777778 | 0.009641 |
| 110 | Cambodia | 51384 | 999.0 | 628 | 26.0 | 44858 | 715.0 | 5898 | -1 | 3031.0 | 37.0 | 1364830 | 80521 | 16950048 | Asia | 1.944185 | 4.140127 | 1.593919 |
| 111 | Zimbabwe | 51221 | 1357.0 | 1808 | 19.0 | 39411 | 290.0 | 10002 | 10 | 3397.0 | 120.0 | 680254 | 45113 | 15078966 | Africa | 2.649304 | 1.050885 | 0.735835 |
| 112 | Jamaica | 50166 | 42.0 | 1080 | 5.0 | 30192 | 118.0 | 18894 | 11 | 16868.0 | 363.0 | 442078 | 148642 | 2974105 | North America | 0.083722 | 0.462963 | 0.390832 |
| 113 | Ivory Coast | 48378 | 73.0 | 315 | 2.0 | 47862 | 28.0 | 201 | -1 | 1790.0 | 12.0 | 711845 | 26337 | 27028679 | Africa | 0.150895 | 0.634921 | 0.058502 |
| 114 | Senegal | 43263 | 130.0 | 1168 | 2.0 | 41487 | 58.0 | 608 | 11 | 2518.0 | 68.0 | 566561 | 32972 | 17183081 | Africa | 0.300488 | 0.171233 | 0.139803 |
| 115 | Madagascar | 42247 | 31.0 | 915 | 2.0 | 40651 | 22.0 | 681 | 45 | 1488.0 | 32.0 | 214402 | 7549 | 28399659 | Africa | 0.073378 | 0.218579 | 0.054119 |
| 116 | DRC | 41353 | 112.0 | 933 | 5.0 | 28422 | 10.0 | 11998 | -1 | 448.0 | 10.0 | 202242 | 2192 | 92268271 | Africa | 0.270839 | 0.535906 | 0.035184 |
| 117 | Rwanda | 39914 | 867.0 | 448 | 10.0 | 27272 | -1.0 | 12194 | 37 | 3007.0 | 34.0 | 1650629 | 124370 | 13271910 | Africa | 2.172170 | 2.232143 | -0.003667 |
| 118 | Angola | 38965 | 116.0 | 903 | 3.0 | 33271 | 29.0 | 4791 | 11 | 1150.0 | 27.0 | 648883 | 19151 | 33882434 | Africa | 0.297703 | 0.332226 | 0.087163 |
| 119 | Sudan | 36709 | 51.0 | 2760 | 6.0 | 30543 | 27.0 | 3406 | -1 | 818.0 | 62.0 | 234414 | 5224 | 44869090 | Africa | 0.138931 | 0.217391 | 0.088400 |
| 120 | Malawi | 36359 | 233.0 | 1199 | 3.0 | 33228 | 59.0 | 1932 | 54 | 1853.0 | 61.0 | 269547 | 13737 | 19622010 | Africa | 0.640832 | 0.250209 | 0.177561 |
| 121 | Trinidad and Tobago | 33029 | 236.0 | 857 | 10.0 | 25229 | 408.0 | 6943 | 22 | 23524.0 | 610.0 | 232452 | 165561 | 1404026 | North America | 0.714524 | 1.166861 | 1.617187 |
| 122 | Cabo Verde | 32594 | 70.0 | 287 | 1.0 | 31692 | 67.0 | 615 | 23 | 57994.0 | 511.0 | 173898 | 309414 | 562023 | Africa | 0.214763 | 0.348432 | 0.211410 |
| 123 | Australia | 30644 | 33.0 | 910 | -1.0 | 29358 | -1.0 | 376 | 1 | 1188.0 | 35.0 | 20804647 | 806521 | 25795538 | Australia/Oceania | 0.107688 | -0.109890 | -0.003406 |
| 124 | Malta | 30627 | 4.0 | 420 | -1.0 | 30161 | 3.0 | 46 | -1 | 69179.0 | 949.0 | 988157 | 2232008 | 442721 | Europe | 0.013060 | -0.238095 | 0.009947 |
| 125 | Réunion | 30583 | -1.0 | 237 | -1.0 | 28585 | -1.0 | 1761 | 32 | 33917.0 | 263.0 | 102720 | 113918 | 901704 | Africa | -0.003270 | -0.421941 | -0.003498 |
| 126 | French Guiana | 27628 | 92.0 | 146 | 1.0 | 9995 | -1.0 | 17487 | 40 | 90173.0 | 477.0 | 289434 | 944665 | 306388 | South America | 0.332996 | 0.684932 | -0.010005 |
| 127 | Syria | 25551 | 36.0 | 1879 | 3.0 | 21831 | 6.0 | 1841 | -1 | 1426.0 | 105.0 | 103566 | 5778 | 17924026 | Asia | 0.140895 | 0.159659 | 0.027484 |
| 128 | Gabon | 25054 | -1.0 | 159 | -1.0 | 24729 | -1.0 | 166 | 9 | 10998.0 | 70.0 | 888883 | 390196 | 2278044 | Africa | -0.003991 | -0.628931 | -0.004044 |
| 129 | Guinea | 23787 | 17.0 | 172 | 1.0 | 22477 | 21.0 | 1138 | 24 | 1764.0 | 13.0 | 468972 | 34771 | 13487256 | Africa | 0.071468 | 0.581395 | 0.093429 |
| 130 | Suriname | 21936 | 204.0 | 531 | 9.0 | 17832 | 175.0 | 3573 | 34 | 37061.0 | 897.0 | 79936 | 135053 | 591888 | South America | 0.929978 | 1.694915 | 0.981382 |
| 131 | Mauritania | 20894 | 86.0 | 489 | -1.0 | 19816 | 26.0 | 589 | 16 | 4379.0 | 102.0 | 309242 | 64813 | 4771300 | Africa | 0.411601 | -0.204499 | 0.131207 |
| 132 | Guyana | 20142 | 87.0 | 473 | 4.0 | 18109 | 69.0 | 1560 | 12 | 25485.0 | 598.0 | 189878 | 240245 | 790351 | South America | 0.431933 | 0.845666 | 0.381026 |
| 133 | Mayotte | 19405 | -1.0 | 174 | -1.0 | 2964 | -1.0 | 16267 | 6 | 69460.0 | 623.0 | 176919 | 633278 | 279370 | Africa | -0.005153 | -0.574713 | -0.033738 |
| 134 | Eswatini | 19084 | -1.0 | 678 | -1.0 | 18107 | -1.0 | 299 | 10 | 16281.0 | 578.0 | 225813 | 192645 | 1172171 | Africa | -0.005240 | -0.147493 | -0.005523 |
| 135 | French Polynesia | 19007 | -1.0 | 142 | -1.0 | 18851 | -1.0 | 14 | -1 | 67274.0 | 503.0 | 26355 | 93281 | 282533 | Australia/Oceania | -0.005261 | -0.704225 | -0.005305 |
| 136 | Haiti | 18665 | 7.0 | 438 | 2.0 | 12865 | 18.0 | 5362 | -1 | 1617.0 | 38.0 | 89917 | 7791 | 11541410 | North America | 0.037503 | 0.456621 | 0.139914 |
| 137 | Vietnam | 17576 | 713.0 | 81 | -1.0 | 7247 | 407.0 | 10248 | -1 | 179.0 | 0.8 | 8434266 | 85876 | 98214329 | Asia | 4.056668 | -1.234568 | 5.616117 |
| 138 | Papua New Guinea | 17098 | -1.0 | 173 | -1.0 | 16518 | -1.0 | 407 | 7 | 1876.0 | 19.0 | 131712 | 14448 | 9116053 | Australia/Oceania | -0.005849 | -0.578035 | -0.006054 |
| 139 | Guadeloupe | 17028 | -1.0 | 230 | -1.0 | 2250 | -1.0 | 14548 | 23 | 42549.0 | 575.0 | 226329 | 565550 | 400193 | North America | -0.005873 | -0.434783 | -0.044444 |
| 140 | Seychelles | 15579 | -1.0 | 68 | -1.0 | 14365 | -1.0 | 1146 | -1 | 157434.0 | 687.0 | 21504 | 217309 | 98956 | Africa | -0.006419 | -1.470588 | -0.006961 |
| 141 | Somalia | 14946 | -1.0 | 775 | -1.0 | 7246 | -1.0 | 6925 | -1 | 915.0 | 47.0 | 150573 | 9218 | 16334341 | Africa | -0.006691 | -0.129032 | -0.013801 |
| 142 | Taiwan | 14853 | 50.0 | 661 | 13.0 | 11608 | 54.0 | 2584 | -1 | 623.0 | 28.0 | 2182211 | 91459 | 23859949 | Asia | 0.336632 | 1.966717 | 0.465196 |
| 143 | Mali | 14428 | 2.0 | 525 | -1.0 | 10062 | 3.0 | 3841 | -1 | 693.0 | 25.0 | 319984 | 15361 | 20830958 | Africa | 0.013862 | -0.190476 | 0.029815 |
| 144 | Togo | 13962 | 45.0 | 130 | 1.0 | 13517 | 4.0 | 315 | -1 | 1648.0 | 15.0 | 364674 | 43045 | 8471995 | Africa | 0.322303 | 0.769231 | 0.029592 |
| 145 | Andorra | 13918 | 7.0 | 127 | -1.0 | 13721 | 1.0 | 70 | -1 | 179845.0 | 1641.0 | 193595 | 2501583 | 77389 | Europe | 0.050295 | -0.787402 | 0.007288 |
| 146 | Tajikistan | 13523 | 24.0 | 90 | -1.0 | 13318 | 16.0 | 115 | -1 | 1387.0 | 9.0 | -1 | -1 | 9751088 | Asia | 0.177475 | -1.111111 | 0.120138 |
| 147 | Burkina Faso | 13485 | 6.0 | 168 | -1.0 | 13308 | 7.0 | 9 | -1 | 628.0 | 8.0 | 196552 | 9153 | 21473577 | Africa | 0.044494 | -0.595238 | 0.052600 |
| 148 | Belize | 13300 | 49.0 | 329 | -1.0 | 12665 | 11.0 | 306 | 1 | 32853.0 | 813.0 | 155629 | 384431 | 404829 | North America | 0.368421 | -0.303951 | 0.086854 |
| 149 | Bahamas | 12735 | 149.0 | 246 | -1.0 | 11603 | 59.0 | 886 | 3 | 32078.0 | 620.0 | 107478 | 270725 | 397001 | North America | 1.170004 | -0.406504 | 0.508489 |
| 150 | Congo | 12695 | 99.0 | 166 | 1.0 | 11211 | -1.0 | 1318 | -1 | 2246.0 | 29.0 | 158304 | 28002 | 5653333 | Africa | 0.779835 | 0.602410 | -0.008920 |
| 151 | Martinique | 12374 | -1.0 | 98 | -1.0 | 98 | -1.0 | 12178 | 1 | 33000.0 | 261.0 | 200461 | 534601 | 374973 | North America | -0.008081 | -1.020408 | -1.020408 |
| 152 | Curaçao | 12343 | 1.0 | 126 | -1.0 | 12197 | 8.0 | 20 | 4 | 74913.0 | 765.0 | 137600 | 835129 | 164765 | North America | 0.008102 | -0.793651 | 0.065590 |
| 153 | Hong Kong | 11928 | 4.0 | 211 | -1.0 | 11631 | 1.0 | 86 | 1 | 1578.0 | 28.0 | 16710131 | 2210975 | 7557812 | Asia | 0.033535 | -0.473934 | 0.008598 |
| 154 | Djibouti | 11602 | -1.0 | 155 | -1.0 | 11443 | -1.0 | 4 | -1 | 11575.0 | 155.0 | 172602 | 172198 | 1002346 | Africa | -0.008619 | -0.645161 | -0.008739 |
| 155 | Lesotho | 11416 | 72.0 | 329 | -1.0 | 6457 | 10.0 | 4630 | -1 | 5287.0 | 152.0 | 113636 | 52628 | 2159234 | Africa | 0.630694 | -0.303951 | 0.154871 |
| 156 | Aruba | 11140 | 2.0 | 107 | -1.0 | 11005 | 4.0 | 28 | 14 | 103899.0 | 998.0 | 177500 | 1655475 | 107220 | North America | 0.017953 | -0.934579 | 0.036347 |
| 157 | South Sudan | 10846 | 12.0 | 117 | -1.0 | 10514 | -1.0 | 215 | -1 | 958.0 | 10.0 | 174045 | 15368 | 11324863 | Africa | 0.110640 | -0.854701 | -0.009511 |
| 158 | Timor-Leste | 9278 | 56.0 | 24 | 1.0 | 8425 | 65.0 | 829 | -1 | 6906.0 | 18.0 | 93497 | 69593 | 1343489 | Asia | 0.603578 | 4.166667 | 0.771513 |
| 159 | Equatorial Guinea | 8742 | 8.0 | 122 | 1.0 | 8534 | 13.0 | 86 | 1 | 6034.0 | 84.0 | 149330 | 103073 | 1448776 | Africa | 0.091512 | 0.819672 | 0.152332 |
| 160 | Benin | 8199 | -1.0 | 104 | -1.0 | 8000 | -1.0 | 95 | 5 | 659.0 | 8.0 | 604310 | 48581 | 12439252 | Africa | -0.012197 | -0.961538 | -0.012500 |
| 161 | Nicaragua | 8178 | -1.0 | 191 | -1.0 | 4225 | -1.0 | 3762 | -1 | 1220.0 | 28.0 | -1 | -1 | 6703307 | North America | -0.012228 | -0.523560 | -0.023669 |
| 162 | CAR | 7141 | -1.0 | 98 | -1.0 | 6859 | -1.0 | 184 | 2 | 1453.0 | 20.0 | 54814 | 11156 | 4913552 | Africa | -0.014004 | -1.020408 | -0.014579 |
| 163 | Yemen | 6923 | 3.0 | 1361 | -1.0 | 4081 | 13.0 | 1481 | 23 | 227.0 | 45.0 | 111430 | 3656 | 30480548 | Asia | 0.043334 | -0.073475 | 0.318549 |
| 164 | Iceland | 6654 | 5.0 | 30 | -1.0 | 6600 | 4.0 | 24 | 1 | 19373.0 | 87.0 | 778558 | 2266815 | 343459 | Europe | 0.075143 | -3.333333 | 0.060606 |
| 165 | Gambia | 6079 | -1.0 | 181 | -1.0 | 5858 | -1.0 | 40 | 3 | 2447.0 | 73.0 | 82460 | 33194 | 2484207 | Africa | -0.016450 | -0.552486 | -0.017071 |
| 166 | Eritrea | 6028 | 19.0 | 25 | 2.0 | 5559 | 47.0 | 444 | -1 | 1677.0 | 7.0 | 23693 | 6590 | 3595441 | Africa | 0.315196 | 8.000000 | 0.845476 |
| 167 | Sierra Leone | 5652 | 77.0 | 102 | 2.0 | 3562 | 40.0 | 1988 | -1 | 694.0 | 13.0 | 156766 | 19262 | 8138707 | Africa | 1.362350 | 1.960784 | 1.122965 |
| 168 | Niger | 5492 | 3.0 | 193 | -1.0 | 5207 | 1.0 | 92 | 2 | 219.0 | 8.0 | 118729 | 4735 | 25076313 | Africa | 0.054625 | -0.518135 | 0.019205 |
| 169 | Burundi | 5482 | 30.0 | 8 | -1.0 | 773 | -1.0 | 4701 | -1 | 448.0 | 0.7 | 345742 | 28240 | 12242910 | Africa | 0.547246 | -12.500000 | -0.129366 |
| 170 | Saint Lucia | 5302 | 6.0 | 84 | -1.0 | 5124 | 3.0 | 94 | -1 | 28742.0 | 455.0 | 53725 | 291245 | 184467 | North America | 0.113165 | -1.190476 | 0.058548 |
| 171 | San Marino | 5091 | -1.0 | 90 | -1.0 | 5000 | -1.0 | 1 | -1 | 149726.0 | 2647.0 | 68523 | 2015264 | 34002 | Europe | -0.019643 | -1.111111 | -0.020000 |
| 172 | Chad | 4951 | -1.0 | 174 | -1.0 | 4769 | -1.0 | 8 | -1 | 293.0 | 10.0 | 126118 | 7465 | 16894664 | Africa | -0.020198 | -0.574713 | -0.020969 |
| 173 | Fiji | 4849 | 431.0 | 24 | 3.0 | 918 | 36.0 | 3907 | 21 | 5370.0 | 27.0 | 202800 | 224599 | 902943 | Australia/Oceania | 8.888431 | 12.500000 | 3.921569 |
| 174 | Channel Islands | 4448 | 65.0 | 86 | -1.0 | 3994 | -1.0 | 368 | -1 | 25350.0 | 490.0 | 563229 | 3209922 | 175465 | Europe | 1.461331 | -1.162791 | -0.025038 |
| 175 | Gibraltar | 4351 | 3.0 | 94 | -1.0 | 4229 | 3.0 | 28 | -1 | 129183.0 | 2791.0 | 279654 | 8303020 | 33681 | Europe | 0.068950 | -1.063830 | 0.070939 |
| 176 | Liberia | 4304 | 211.0 | 129 | 1.0 | 2392 | 46.0 | 1783 | 2 | 832.0 | 25.0 | 119695 | 23125 | 5176088 | Africa | 4.902416 | 0.775194 | 1.923077 |
| 177 | Barbados | 4082 | 1.0 | 47 | -1.0 | 3999 | -1.0 | 36 | -1 | 14187.0 | 163.0 | 186328 | 647586 | 287727 | North America | 0.024498 | -2.127660 | -0.025006 |
| 178 | Comoros | 3943 | 7.0 | 146 | -1.0 | 3765 | -1.0 | 32 | -1 | 4440.0 | 164.0 | -1 | -1 | 888064 | Africa | 0.177530 | -0.684932 | -0.026560 |
| 179 | Guinea-Bissau | 3869 | 10.0 | 69 | -1.0 | 3588 | 5.0 | 212 | 4 | 1921.0 | 34.0 | 73289 | 36384 | 2014330 | Africa | 0.258465 | -1.449275 | 0.139353 |
| 180 | Liechtenstein | 3039 | 3.0 | 59 | -1.0 | 2963 | 1.0 | 17 | 3 | 79476.0 | 1543.0 | 49126 | 1284743 | 38238 | Europe | 0.098717 | -1.694915 | 0.033750 |
| 181 | New Zealand | 2742 | -1.0 | 26 | -1.0 | 2686 | 1.0 | 30 | -1 | 548.0 | 5.0 | 2288871 | 457582 | 5002100 | Australia/Oceania | -0.036470 | -3.846154 | 0.037230 |
| 182 | Sint Maarten | 2618 | -1.0 | 33 | -1.0 | 2547 | -1.0 | 38 | 2 | 60375.0 | 761.0 | 28642 | 660532 | 43362 | North America | -0.038197 | -3.030303 | -0.039262 |
| 183 | Monaco | 2580 | 3.0 | 33 | -1.0 | 2521 | 1.0 | 26 | 1 | 65283.0 | 835.0 | 54960 | 1390688 | 39520 | Europe | 0.116279 | -3.030303 | 0.039667 |
| 184 | Bermuda | 2514 | -1.0 | 33 | -1.0 | 2466 | -1.0 | 15 | 7 | 40518.0 | 532.0 | 320654 | 5167921 | 62047 | North America | -0.039777 | -3.030303 | -0.040552 |
| 185 | Turks and Caicos | 2425 | -1.0 | 18 | -1.0 | 2398 | -1.0 | 9 | 2 | 61799.0 | 459.0 | 94789 | 2415622 | 39240 | North America | -0.041237 | -5.555556 | -0.041701 |
| 186 | Sao Tome and Principe | 2369 | 3.0 | 37 | -1.0 | 2320 | 1.0 | 12 | -1 | 10613.0 | 166.0 | 14270 | 63929 | 223218 | Africa | 0.126636 | -2.702703 | 0.043103 |
| 187 | Saint Martin | 2276 | -1.0 | 12 | -1.0 | 1399 | -1.0 | 865 | 7 | 57878.0 | 305.0 | 39038 | 992727 | 39324 | North America | -0.043937 | -8.333333 | -0.071480 |
| 188 | St. Vincent Grenadines | 2227 | 2.0 | 12 | -1.0 | 2006 | 4.0 | 209 | 2 | 20010.0 | 108.0 | 55225 | 496213 | 111293 | North America | 0.089807 | -8.333333 | 0.199402 |
| 189 | Laos | 2144 | 23.0 | 3 | -1.0 | 1986 | -1.0 | 155 | -1 | 290.0 | 0.4 | 289377 | 39206 | 7380980 | Asia | 1.072761 | -33.333333 | -0.050352 |
| 190 | Bhutan | 2104 | 4.0 | 1 | -1.0 | 1811 | 38.0 | 292 | -1 | 2697.0 | 1.0 | 798573 | 1023680 | 780100 | Asia | 0.190114 | -100.000000 | 2.098288 |
| 191 | Mauritius | 1858 | -1.0 | 18 | -1.0 | 1534 | -1.0 | 306 | -1 | 1459.0 | 14.0 | 358675 | 281561 | 1273882 | Africa | -0.053821 | -5.555556 | -0.065189 |
| 192 | Caribbean Netherlands | 1650 | 1.0 | 17 | -1.0 | 1613 | -1.0 | 20 | -1 | 62342.0 | 642.0 | 8550 | 323044 | 26467 | North America | 0.060606 | -5.882353 | -0.061996 |
| 193 | Isle of Man | 1620 | 7.0 | 29 | -1.0 | 1569 | -1.0 | 22 | 1 | 18951.0 | 339.0 | 78217 | 915001 | 85483 | Europe | 0.432099 | -3.448276 | -0.063735 |
| 194 | St. Barth | 1005 | -1.0 | 1 | -1.0 | 462 | -1.0 | 542 | -1 | 101443.0 | 101.0 | 26385 | 2663268 | 9907 | North America | -0.099502 | -100.000000 | -0.216450 |
| 195 | Faeroe Islands | 778 | 2.0 | 1 | -1.0 | 764 | 3.0 | 13 | -1 | 15862.0 | 20.0 | 310333 | 6327000 | 49049 | Europe | 0.257069 | -100.000000 | 0.392670 |
| 196 | Cayman Islands | 614 | -1.0 | 2 | -1.0 | 603 | 8.0 | 9 | -1 | 9234.0 | 30.0 | 107819 | 1621509 | 66493 | North America | -0.162866 | -50.000000 | 1.326700 |
| 197 | Tanzania | 509 | -1.0 | 21 | -1.0 | 183 | -1.0 | 305 | 7 | 8.0 | 0.3 | -1 | -1 | 61426591 | Africa | -0.196464 | -4.761905 | -0.546448 |
| 198 | Saint Kitts and Nevis | 457 | 11.0 | 3 | -1.0 | 199 | 22.0 | 255 | 1 | 8530.0 | 56.0 | 21423 | 399869 | 53575 | North America | 2.407002 | -33.333333 | 11.055276 |
| 199 | British Virgin Islands | 350 | 37.0 | 1 | -1.0 | 300 | 1.0 | 49 | -1 | 11501.0 | 33.0 | 56092 | 1843191 | 30432 | North America | 10.571429 | -100.000000 | 0.333333 |
| 200 | Brunei | 261 | 1.0 | 3 | -1.0 | 248 | -1.0 | 10 | -1 | 591.0 | 7.0 | 141157 | 319601 | 441667 | Asia | 0.383142 | -33.333333 | -0.403226 |
| 201 | Dominica | 193 | -1.0 | -1 | -1.0 | 191 | -1.0 | 2 | -1 | 2674.0 | -1.0 | 18689 | 258976 | 72165 | North America | -0.518135 | 100.000000 | -0.523560 |
| 202 | New Caledonia | 129 | -1.0 | -1 | -1.0 | 58 | -1.0 | 71 | -1 | 448.0 | -1.0 | 34704 | 120399 | 288242 | Australia/Oceania | -0.775194 | 100.000000 | -1.724138 |
| 203 | Macao | 54 | -1.0 | -1 | -1.0 | 51 | -1.0 | 3 | -1 | 82.0 | -1.0 | 4568 | 6940 | 658176 | Asia | -1.851852 | 100.000000 | -1.960784 |
| 204 | Western Sahara | 10 | -1.0 | 1 | -1.0 | 8 | -1.0 | 1 | -1 | 16.0 | 2.0 | -1 | -1 | 611963 | Africa | -10.000000 | -100.000000 | -12.500000 |
| 205 | Total: | 183401218 | 432413.0 | 3971191 | 8320.0 | 167909780 | 362543.0 | 11520247 | 78708 | 23528.7 | 509.5 | -1 | -1 | -1 | All | 0.235774 | 0.209509 | 0.215915 |
EXPORT = True
today = datetime.now()
if EXPORT:
today = date.today()
df.to_csv(f'covid_stats_{today.year}_{today.month}_{today.day-1}')
print("Dataset is %.2f MB" % (df.memory_usage(deep=True).sum()/1000000))
Dataset is 0.05 MB
cases_ser = df[["Total Recovered", "Active Cases", "Total Deaths"]].loc[0]
cases_df = pd.DataFrame(cases_ser).reset_index()
cases_df.columns = ['Type', 'Total']
cases_df['Percentage'] = np.round(100*cases_df['Total']/np.sum(cases_df['Total']), 2)
cases_df['Virus'] = ['COVID-19' for i in range(len(cases_df))]
fig = px.bar(cases_df, x='Virus', y='Percentage', color='Type', hover_data=['Total'])
fig.update_layout(title={'text': f"Total Number of Cases, Recoveries, and Deaths on {yesterday_str}", 'x': 0.5,
'xanchor': 'center', 'font': {'size': 20}}, yaxis_title="Percentage", xaxis_title="")
fig.show()
new_ser = df[["New Cases", "New Recovered", "New Deaths"]].loc[0]
new_df = pd.DataFrame(new_ser).reset_index()
new_df.columns = ['Type', 'Total']
new_df['Percentage'] = np.round(100*new_df['Total']/np.sum(new_df['Total']), 2)
new_df['Virus'] = ['COVID-19' for i in range(len(new_df))]
fig = px.bar(new_df, x='Virus', y='Percentage', color='Type', hover_data=['Total'])
fig.update_layout(title={'text': f"New Cases, Recoveries, and Deaths on {yesterday_str}", 'x': 0.5,
'xanchor': 'center', 'font': {'size': 20}}, yaxis_title="Percentage", xaxis_title="")
fig.show()
pinc_ser = np.round(df[["%Inc Cases", "%Inc Recovered", "%Inc Deaths"]].loc[0], 2)
pinc_df = pd.DataFrame(pinc_ser)
pinc_df.columns = ["Percentage"]
fig = go.Figure()
fig.add_trace(go.Bar(x=pinc_df.index, y=pinc_df['Percentage'], marker_color=["yellow", "green", "red"]))
fig.update_layout(title={'text': f"New Cases, Recoveries, and Deaths on {yesterday_str}", 'x': 0.5,
'xanchor': 'center', 'font': {'size': 20}}, yaxis_title="Percentage", xaxis_title="")
fig.show()
continent_df = df.groupby('Continent').sum().drop('All')
continent_df = continent_df.reset_index()
continent_df
| Continent | Total Cases | New Cases | Total Deaths | New Deaths | Total Recovered | New Recovered | Active Cases | Serious/Critical | Tot Cases/1M | Deaths/1M | Total Tests | Tests/1M | Population | %Inc Cases | %Inc Deaths | %Inc Recovered | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Africa | 5597459 | 42324.0 | 144152 | 762.0 | 4865662 | 18797.0 | 587645 | 4566 | 632767.0 | 9008.0 | 53288244 | 5067522 | 1372550040 | 18.549048 | -103.361394 | 3.254985 |
| 1 | Asia | 55895372 | 152190.0 | 789607 | 2362.0 | 53261352 | 131082.0 | 1844412 | 26628 | 1516336.0 | 14860.2 | 827190324 | 36273093 | 3204101596 | 26.007992 | -41.771949 | 25.086106 |
| 2 | Australia/Oceania | 74469 | 460.0 | 1274 | -2.0 | 68389 | 33.0 | 4805 | 26 | 76704.0 | 588.0 | 23489089 | 1716830 | 41387409 | 8.173346 | 107.261696 | 2.219896 |
| 3 | Europe | 48057971 | 77237.0 | 1103780 | 949.0 | 45470438 | 44986.0 | 1483753 | 6844 | 3561256.0 | 69386.0 | 973440513 | 85766626 | 748081910 | 5.934701 | -114.484000 | 3.435491 |
| 4 | North America | 40643482 | 34094.0 | 919005 | 707.0 | 34134543 | 35722.0 | 5589933 | 10886 | 1267712.0 | 17499.0 | 568482326 | 26812243 | 593429579 | 18.766630 | -219.557430 | 16.625885 |
| 5 | South America | 33037753 | 126062.0 | 1008667 | 3458.0 | 28299160 | 131844.0 | 1865059 | 29690 | 801247.0 | 22166.0 | 132952969 | 5014762 | 434309452 | 5.388683 | 7.379605 | 5.694784 |
cases_vis_list = ['Total Cases', 'Active Cases', 'New Cases', 'Serious/Critical', 'Tot Cases/1M']
deaths_vis_list = ['Total Deaths', 'New Deaths', 'Deaths/1M']
recovered_vis_list = ['Total Recovered', 'New Recovered']
tests_vis_list = ['Total Tests', 'Tests/1M']
essentials = [['Total Cases', 'Active Cases', 'New Cases'], ['Total Deaths', 'New Deaths'], ['Total Recovered', 'New Recovered']]
def continent_visualization(vis_list):
for label in vis_list:
c_df = continent_df[['Continent', label]]
c_df['Percentage'] = np.round(100*c_df[label]/np.sum(c_df[label]), 2)
c_df['Virus'] = ['COVID-19' for i in range(len(c_df))]
fig = px.bar(c_df, x='Virus', y='Percentage', color='Continent', hover_data=[label])
fig.update_layout(title={'text': f"{label} at the end of {yesterday_str}", 'x': 0.5,
'xanchor': 'center', 'font': {'size': 20}}, yaxis_title="Percentage", xaxis_title="")
fig.show()
gc.collect()
continent_visualization(cases_vis_list)
continent_visualization(deaths_vis_list)
continent_visualization(tests_vis_list)
def continent_visualization2(index, label, log_scale=False):
c_df = continent_df[['Continent'] + essentials[index]]
fig = px.bar(c_df, x="Continent", y=essentials[index], log_y=log_scale)
log_str = "- log scale" if log_scale else ""
fig.update_layout(title={'text': f"{label} at the end of {yesterday_str} {log_str}", 'x': 0.5,
'xanchor': 'center', 'font': {'size': 20}}, yaxis_title=label, xaxis_title="")
fig.show()
gc.collect()
continent_visualization2(0, "Total Cases", log_scale=True)
continent_visualization2(1, "Deaths", log_scale=True)
continent_visualization2(2, "Recoveries", log_scale=True)
df = df.drop([len(df)-1])
country_df = df.drop([0])
country_l = country_df.columns[1:14]
fig = go.Figure()
c = 0
for i in country_df.index:
if c < LOOK_AT:
fig.add_trace(go.Bar(name=country_df['Country'][i], x=country_l, y=country_df.loc[i][1:14]))
else:
break
c += 1
fig.update_layout(title={'text': f'{LOOK_AT} Countries with Most COVID Cases on %s' % yesterday_str, 'x': 0.5,
'xanchor': 'center', 'font': {'size': 20}}, yaxis_title="Percentage", yaxis_type="log", xaxis_tickangle=-90)
fig.show()
inc_l = country_df.columns[15:]
inc_df = country_df.sort_values("%Inc Cases", ascending=False)
fig = go.Figure()
c = 0
for i in inc_df.index:
if i > AT_LEAST:
continue
if c < LOOK_AT:
fig.add_trace(go.Bar(name=country_df['Country'][i], x=inc_l, y=inc_df.loc[i][15:]))
else:
break
c += 1
fig.update_layout(title={'text': f'{LOOK_AT} Countries with Highest Increase in COVID Cases on %s' % yesterday_str, 'x': 0.5,
'xanchor': 'center', 'font': {'size': 20}}, yaxis_title="Percentage", xaxis_tickangle=0)
fig.show()
country_labels = country_df.columns[1:14]
def country_visualization(continent):
buttons_list = []
base_list = [False for i in range(len(country_df))]
c = 0
for i in country_df.index:
if country_df.loc[i]['Continent'] != continent:
continue
tmp_list = base_list.copy()
tmp_list[c] = True
c += 1
buttons_list.append(dict(
args=[{"visible": tmp_list}],
label=country_df.loc[i]['Country'],
method="update"
))
fig = go.Figure()
c = 0
for i in country_df.index:
if country_df.loc[i]['Continent'] != continent:
continue
fig.add_trace(go.Bar(name=country_df.loc[i]['Country'], x=country_labels, y=country_df.loc[i][1:14], visible=False if c != 0 else True))
c += 1
fig.update_layout(
updatemenus=[
dict(
buttons=buttons_list,
direction="down",
pad={"r": 10, "t": 10},
showactive=True,
x=0.1,
xanchor="left",
y=1.1,
yanchor="top"
),
]
)
fig.update_layout(title={'text': '%s COVID-19 Cases Search on %s' % (continent, yesterday_str), 'x': 0.5,
'xanchor': 'center', 'font': {'size': 20}}, yaxis_type="log", xaxis_tickangle=-90)
fig.show()
country_visualization('Africa')
country_visualization('Asia')
country_visualization('Australia/Oceania')
country_visualization('Europe')
country_visualization('North America')
country_visualization('South America')
bar_list = []
for i in country_df.index:
bar_list.append(go.Bar(name=country_df['Country'][i], y=[country_df['Total Cases'][i]]))
fig = go.Figure(data=bar_list)
fig.update_layout(title={'text': 'Stacked Bar Chart of All Countries COVID-19 Cases on %s' % yesterday_str, 'x': 0.5,
'xanchor': 'center', 'font': {'size': 20}}, barmode='stack', height=1200)
fig.show()
bar = go.Bar(x=country_df['Country'], y=country_df['Total Cases'], marker=dict(color=df['Total Cases'], colorscale='Reds', showscale=True))
fig = go.Figure(data=[bar])
fig.update_layout(title={'text': 'Number of COVID Cases by Country on %s, log scale' % yesterday_str, 'x': 0.5,
'xanchor': 'center', 'font': {'size': 20}}, yaxis_type="log", xaxis_tickangle=-90)
country_abbrev = {
'Afghanistan': 'AFG',
'Albania': 'ALB',
'Algeria': 'DZA',
'American Samoa': 'ASM',
'Andorra': 'AND',
'Angola': 'AGO',
'Anguilla': 'AIA',
'Antigua and Barbuda': 'ATG',
'Argentina': 'ARG',
'Armenia': 'ARM',
'Aruba': 'ABW',
'Australia': 'AUS',
'Austria': 'AUT',
'Azerbaijan': 'AZE',
'Bahamas, The': 'BHM',
'Bahrain': 'BHR',
'Bangladesh': 'BGD',
'Barbados': 'BRB',
'Belarus': 'BLR',
'Belgium': 'BEL',
'Belize': 'BLZ',
'Benin': 'BEN',
'Bermuda': 'BMU',
'Bhutan': 'BTN',
'Bolivia': 'BOL',
'Bosnia and Herzegovina': 'BIH',
'Botswana': 'BWA',
'Brazil': 'BRA',
'British Virgin Islands': 'VGB',
'Brunei': 'BRN',
'Bulgaria': 'BGR',
'Burkina Faso': 'BFA',
'Burma': 'MMR',
'Burundi': 'BDI',
'Cabo Verde': 'CPV',
'Cambodia': 'KHM',
'Cameroon': 'CMR',
'Canada': 'CAN',
'Cayman Islands': 'CYM',
'Central African Republic': 'CAF',
'Chad': 'TCD',
'Chile': 'CHL',
'China': 'CHN',
'Colombia': 'COL',
'Comoros': 'COM',
'Congo, Democratic Republic of the': 'COD',
'Congo, Republic of the': 'COG',
'Cook Islands': 'COK',
'Costa Rica': 'CRI',
"Cote d'Ivoire": 'CIV',
'Croatia': 'HRV',
'Cuba': 'CUB',
'Curacao': 'CUW',
'Cyprus': 'CYP',
'Czech Republic': 'CZE',
'Czechia': 'CZE',
'Denmark': 'DNK',
'Djibouti': 'DJI',
'Dominica': 'DMA',
'Dominican Republic': 'DOM',
'Ecuador': 'ECU',
'Egypt': 'EGY',
'El Salvador': 'SLV',
'Equatorial Guinea': 'GNQ',
'Eritrea': 'ERI',
'Estonia': 'EST',
'Ethiopia': 'ETH',
'Falkland Islands (Islas Malvinas)': 'FLK',
'Faroe Islands': 'FRO',
'Fiji': 'FJI',
'Finland': 'FIN',
'France': 'FRA',
'French Polynesia': 'PYF',
'Gabon': 'GAB',
'Gambia, The': 'GMB',
'Georgia': 'GEO',
'Germany': 'DEU',
'Ghana': 'GHA',
'Gibraltar': 'GIB',
'Greece': 'GRC',
'Greenland': 'GRL',
'Grenada': 'GRD',
'Guam': 'GUM',
'Guatemala': 'GTM',
'Guernsey': 'GGY',
'Guinea-Bissau': 'GNB',
'Guinea': 'GIN',
'Guyana': 'GUY',
'Haiti': 'HTI',
'Honduras': 'HND',
'Hong Kong': 'HKG',
'Hungary': 'HUN',
'Iceland': 'ISL',
'India': 'IND',
'Indonesia': 'IDN',
'Iran': 'IRN',
'Iraq': 'IRQ',
'Ireland': 'IRL',
'Isle of Man': 'IMN',
'Israel': 'ISR',
'Italy': 'ITA',
'Jamaica': 'JAM',
'Japan': 'JPN',
'Jersey': 'JEY',
'Jordan': 'JOR',
'Kazakhstan': 'KAZ',
'Kenya': 'KEN',
'Kiribati': 'KIR',
'Korea, North': 'PRK',
'Korea, South': 'KOR',
'Kosovo': 'KSV',
'Kuwait': 'KWT',
'Kyrgyzstan': 'KGZ',
'Laos': 'LAO',
'Latvia': 'LVA',
'Lebanon': 'LBN',
'Lesotho': 'LSO',
'Liberia': 'LBR',
'Libya': 'LBY',
'Liechtenstein': 'LIE',
'Lithuania': 'LTU',
'Luxembourg': 'LUX',
'Macau': 'MAC',
'Macedonia': 'MKD',
'Madagascar': 'MDG',
'Malawi': 'MWI',
'Malaysia': 'MYS',
'Maldives': 'MDV',
'Mali': 'MLI',
'Malta': 'MLT',
'Marshall Islands': 'MHL',
'Mauritania': 'MRT',
'Mauritius': 'MUS',
'Mexico': 'MEX',
'Micronesia, Federated States of': 'FSM',
'Moldova': 'MDA',
'Monaco': 'MCO',
'Mongolia': 'MNG',
'Montenegro': 'MNE',
'Morocco': 'MAR',
'Mozambique': 'MOZ',
'Namibia': 'NAM',
'Nepal': 'NPL',
'Netherlands': 'NLD',
'New Caledonia': 'NCL',
'New Zealand': 'NZL',
'Nicaragua': 'NIC',
'Nigeria': 'NGA',
'Niger': 'NER',
'Niue': 'NIU',
'Northern Mariana Islands': 'MNP',
'Norway': 'NOR',
'Oman': 'OMN',
'Pakistan': 'PAK',
'Palau': 'PLW',
'Panama': 'PAN',
'Papua New Guinea': 'PNG',
'Paraguay': 'PRY',
'Peru': 'PER',
'Philippines': 'PHL',
'Poland': 'POL',
'Portugal': 'PRT',
'Puerto Rico': 'PRI',
'Qatar': 'QAT',
'Romania': 'ROU',
'Russia': 'RUS',
'Rwanda': 'RWA',
'Saint Kitts and Nevis': 'KNA',
'Saint Lucia': 'LCA',
'Saint Martin': 'MAF',
'Saint Pierre and Miquelon': 'SPM',
'Saint Vincent and the Grenadines': 'VCT',
'Samoa': 'WSM',
'San Marino': 'SMR',
'Sao Tome and Principe': 'STP',
'Saudi Arabia': 'SAU',
'Senegal': 'SEN',
'Serbia': 'SRB',
'Seychelles': 'SYC',
'Sierra Leone': 'SLE',
'Singapore': 'SGP',
'Sint Maarten': 'SXM',
'Slovakia': 'SVK',
'Slovenia': 'SVN',
'Solomon Islands': 'SLB',
'Somalia': 'SOM',
'South Africa': 'ZAF',
'South Sudan': 'SSD',
'Spain': 'ESP',
'Sri Lanka': 'LKA',
'Sudan': 'SDN',
'Suriname': 'SUR',
'Swaziland': 'SWZ',
'Sweden': 'SWE',
'Switzerland': 'CHE',
'Syria': 'SYR',
'Taiwan': 'TWN',
'Tajikistan': 'TJK',
'Tanzania': 'TZA',
'Thailand': 'THA',
'Timor-Leste': 'TLS',
'Togo': 'TGO',
'Tonga': 'TON',
'Trinidad and Tobago': 'TTO',
'Tunisia': 'TUN',
'Turkey': 'TUR',
'Turkmenistan': 'TKM',
'Tuvalu': 'TUV',
'Uganda': 'UGA',
'Ukraine': 'UKR',
'United Arab Emirates': 'ARE',
'UAE': 'ARE',
'United Kingdom': 'GBR',
'UK': 'GBR',
'United States': 'USA',
'USA': 'USA',
'Uruguay': 'URY',
'Uzbekistan': 'UZB',
'Vanuatu': 'VUT',
'Venezuela': 'VEN',
'Vietnam': 'VNM',
'Virgin Islands': 'VGB',
'West Bank': 'WBG',
'Yemen': 'YEM',
'Zambia': 'ZMB',
'Zimbabwe': 'ZWE',
'S. Korea': 'KOR'
}
country_df['iso_code'] = country_df['Country'].map(country_abbrev)
map_country_df = country_df.loc[~country_df['iso_code'].isna()]
map_country_df['death_rate'] = (100*map_country_df['Total Deaths']/map_country_df['Total Cases']).round(2)
map_country_df.head()
| Country | Total Cases | New Cases | Total Deaths | New Deaths | Total Recovered | New Recovered | Active Cases | Serious/Critical | Tot Cases/1M | Deaths/1M | Total Tests | Tests/1M | Population | Continent | %Inc Cases | %Inc Deaths | %Inc Recovered | iso_code | death_rate | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | USA | 34561607 | 17153.0 | 620657 | 319.0 | 29052087 | 25399.0 | 4888863 | 3868 | 103806.0 | 1864.0 | 506604612 | 1521587 | 332944930 | North America | 0.049630 | 0.051397 | 0.087426 | USA | 1.80 |
| 2 | India | 30453937 | 43360.0 | 400271 | 796.0 | 29536087 | 54565.0 | 517579 | 8944 | 21853.0 | 287.0 | 412021494 | 295659 | 1393568297 | Asia | 0.142379 | 0.198865 | 0.184740 | IND | 1.31 |
| 3 | Brazil | 18622304 | 63140.0 | 520189 | 1943.0 | 16931272 | 72640.0 | 1170843 | 8318 | 86991.0 | 2430.0 | 53209627 | 248561 | 214070952 | South America | 0.339056 | 0.373518 | 0.429029 | BRA | 2.79 |
| 4 | France | 5777965 | 2664.0 | 111111 | 29.0 | 5622756 | 3846.0 | 44098 | 1162 | 88324.0 | 1698.0 | 93465436 | 1428738 | 65418158 | Europe | 0.046106 | 0.026100 | 0.068401 | FRA | 1.92 |
| 5 | Russia | 5538142 | 23543.0 | 135886 | 672.0 | 5017321 | 16928.0 | 384935 | 2300 | 37933.0 | 931.0 | 150121327 | 1028248 | 145997153 | Europe | 0.425106 | 0.494532 | 0.337391 | RUS | 2.45 |
fig = go.Figure(data=go.Choropleth(
locations=map_country_df['iso_code'],
z=map_country_df['Total Cases'].astype(float),
colorscale="Reds",
colorbar_title="Total"
))
fig.update_layout(
geo=dict(
showframe=False,
showcoastlines=False,
projection_type='equirectangular'
),
title={'text': f"Total COVID Cases in the World", 'x': 0.5,
'xanchor': 'center', 'font': {'size': 16}}
)
fig.show()
fig = go.Figure(data=go.Choropleth(
locations=map_country_df['iso_code'],
z=map_country_df['Total Deaths'].astype(float),
colorscale="Reds",
colorbar_title="Total"
))
fig.update_layout(
geo=dict(
showframe=False,
showcoastlines=False,
projection_type='equirectangular'
),
title={'text': f"Total COVID Deaths in the World", 'x': 0.5,
'xanchor': 'center', 'font': {'size': 16}}
)
fig.show()
fig = go.Figure(data=go.Choropleth(
locations=map_country_df['iso_code'],
z=map_country_df['death_rate'].astype(float),
colorscale="Reds",
colorbar_title="Percentage"
))
fig.update_layout(
geo=dict(
showframe=False,
showcoastlines=False,
projection_type='equirectangular'
),
title={'text': f"Death Rate of Different Countries in the World", 'x': 0.5,
'xanchor': 'center', 'font': {'size': 16}}
)
fig.show()
fig = go.Figure(data=go.Choropleth(
locations=map_country_df['iso_code'],
z=map_country_df['Deaths/1M'].astype(float),
colorscale="Reds",
colorbar_title="Per Million"
))
fig.update_layout(
geo=dict(
showframe=False,
showcoastlines=False,
projection_type='equirectangular'
),
title={'text': f"Deaths Per Million in the World", 'x': 0.5,
'xanchor': 'center', 'font': {'size': 16}}
)
fig.show()