14-day cumulative number of COVID-19 cases per 100 000¶
At the end of the page, we provide a detailed description of how the numbers are calculated.
Compute data¶
In [1]:
import pandas as pd
pd.set_option("display.max_rows", None)
from oscovida import get_incidence_rates_countries
Table for all countries¶
In [2]:
cases_incidence, deaths_incidence = get_incidence_rates_countries()
Downloaded data: last data point 3/6/23 from https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv Downloaded data: last data point 3/6/23 from https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_deaths_global.csv
/tank/oscovida/work/oscovida.github.io/oscovida.github.io/.venv/lib/python3.9/site-packages/oscovida/oscovida.py:597: FutureWarning: The default value of numeric_only in DataFrameGroupBy.sum is deprecated. In a future version, numeric_only will default to False. Either specify numeric_only or select only columns which should be valid for the function. cases = cases.groupby(cases.index).sum().astype(int) /tank/oscovida/work/oscovida.github.io/oscovida.github.io/.venv/lib/python3.9/site-packages/oscovida/oscovida.py:598: FutureWarning: The default value of numeric_only in DataFrameGroupBy.sum is deprecated. In a future version, numeric_only will default to False. Either specify numeric_only or select only columns which should be valid for the function. deaths = deaths.groupby(deaths.index).sum().astype(int) /tank/oscovida/work/oscovida.github.io/oscovida.github.io/.venv/lib/python3.9/site-packages/oscovida/oscovida.py:520: FutureWarning: The default value of numeric_only in DataFrameGroupBy.sum is deprecated. In a future version, numeric_only will default to False. Either specify numeric_only or select only columns which should be valid for the function. population
In [3]:
cases_incidence
Out[3]:
| 14-day-sum | population | 14-day-incidence-rate | |
|---|---|---|---|
| Country | |||
| Afghanistan | 253 | 38928341 | 0.6 |
| Albania | 112 | 2877800 | 3.9 |
| Algeria | 51 | 43851043 | 0.1 |
| Andorra | 9 | 77265 | 11.6 |
| Angola | 93 | 32866268 | 0.3 |
| Antarctica | 0 | 0 | NaN |
| Antigua and Barbuda | 0 | 97928 | 0.0 |
| Argentina | 1649 | 45195777 | 3.6 |
| Armenia | 487 | 2963234 | 16.4 |
| Australia | 37836 | 25459700 | 148.6 |
| Austria | 76997 | 9006400 | 854.9 |
| Azerbaijan | 372 | 10139175 | 3.7 |
| Bahamas | 0 | 393248 | 0.0 |
| Bahrain | 4492 | 1701583 | 264.0 |
| Bangladesh | 91 | 164689383 | 0.1 |
| Barbados | 211 | 287371 | 73.4 |
| Belarus | 0 | 9449321 | 0.0 |
| Belgium | 19522 | 11492641 | 169.9 |
| Belize | 17 | 397621 | 4.3 |
| Benin | 0 | 12123198 | 0.0 |
| Bhutan | 9 | 771612 | 1.2 |
| Bolivia | 1766 | 11673029 | 15.1 |
| Bosnia and Herzegovina | 109 | 3280815 | 3.3 |
| Botswana | 65 | 2351625 | 2.8 |
| Brazil | 88371 | 212559409 | 41.6 |
| Brunei | 1257 | 437483 | 287.3 |
| Bulgaria | 944 | 6948445 | 13.6 |
| Burkina Faso | 0 | 20903278 | 0.0 |
| Burma | 46 | 54409794 | 0.1 |
| Burundi | 22 | 11890781 | 0.2 |
| Cabo Verde | 5 | 555988 | 0.9 |
| Cambodia | 11 | 16718971 | 0.1 |
| Cameroon | 64 | 26545864 | 0.2 |
| Canada | 18299 | 38246108 | 47.8 |
| Central African Republic | 0 | 4829764 | 0.0 |
| Chad | 3 | 16425859 | 0.0 |
| Chile | 31734 | 19116209 | 166.0 |
| China | 3 | 1411778724 | 0.0 |
| Colombia | 1764 | 50882884 | 3.5 |
| Comoros | 4 | 869595 | 0.5 |
| Congo (Brazzaville) | 4 | 5518092 | 0.1 |
| Congo (Kinshasa) | 103 | 89561404 | 0.1 |
| Costa Rica | 9580 | 5094114 | 188.1 |
| Cote d'Ivoire | 132 | 26378275 | 0.5 |
| Croatia | 722 | 4105268 | 17.6 |
| Cuba | 78 | 11326616 | 0.7 |
| Cyprus | 3654 | 1207361 | 302.6 |
| Czechia | 12966 | 10708982 | 121.1 |
| Denmark | 1532 | 5837213 | 26.2 |
| Diamond Princess | 0 | 0 | NaN |
| Djibouti | 0 | 988002 | 0.0 |
| Dominica | 0 | 71991 | 0.0 |
| Dominican Republic | 213 | 10847904 | 2.0 |
| Ecuador | 543 | 17643060 | 3.1 |
| Egypt | 0 | 102334403 | 0.0 |
| El Salvador | 0 | 6486201 | 0.0 |
| Equatorial Guinea | 7 | 1402985 | 0.5 |
| Eritrea | 0 | 3546427 | 0.0 |
| Estonia | 580 | 1326539 | 43.7 |
| Eswatini | 68 | 1160164 | 5.9 |
| Ethiopia | 188 | 114963583 | 0.2 |
| Fiji | 21 | 896444 | 2.3 |
| Finland | 1393 | 5540718 | 25.1 |
| France | 52120 | 65249843 | 79.9 |
| Gabon | 0 | 2225728 | 0.0 |
| Gambia | 0 | 2416664 | 0.0 |
| Georgia | 3553 | 3989175 | 89.1 |
| Germany | 192740 | 83155031 | 231.8 |
| Ghana | 49 | 31072945 | 0.2 |
| Greece | 0 | 10423056 | 0.0 |
| Grenada | 0 | 112519 | 0.0 |
| Guatemala | 3506 | 17915567 | 19.6 |
| Guinea | 0 | 13132792 | 0.0 |
| Guinea-Bissau | 7 | 1967998 | 0.4 |
| Guyana | 23 | 786559 | 2.9 |
| Haiti | 59 | 11402533 | 0.5 |
| Holy See | 0 | 809 | 0.0 |
| Honduras | 693 | 9904608 | 7.0 |
| Hungary | 1824 | 9660350 | 18.9 |
| Iceland | 172 | 341250 | 50.4 |
| India | 3235 | 1380004385 | 0.2 |
| Indonesia | 2969 | 273523621 | 1.1 |
| Iran | 3940 | 83992953 | 4.7 |
| Iraq | 0 | 40222503 | 0.0 |
| Ireland | 1327 | 4937796 | 26.9 |
| Israel | 7215 | 8655541 | 83.4 |
| Italy | 56096 | 60461828 | 92.8 |
| Jamaica | 131 | 2961161 | 4.4 |
| Japan | 166539 | 126476458 | 131.7 |
| Jordan | 0 | 10203140 | 0.0 |
| Kazakhstan | 1219 | 18776707 | 6.5 |
| Kenya | 45 | 53771300 | 0.1 |
| Kiribati | 1 | 117606 | 0.9 |
| Korea, North | 0 | 25778815 | 0.0 |
| Korea, South | 135724 | 51269183 | 264.7 |
| Kosovo | 373 | 1810366 | 20.6 |
| Kuwait | 598 | 4270563 | 14.0 |
| Kyrgyzstan | 62 | 6524191 | 1.0 |
| Laos | 8 | 7275556 | 0.1 |
| Latvia | 340 | 1886202 | 18.0 |
| Lebanon | 1477 | 6825442 | 21.6 |
| Lesotho | 0 | 2142252 | 0.0 |
| Liberia | 25 | 5057677 | 0.5 |
| Libya | 16 | 6871287 | 0.2 |
| Liechtenstein | 39 | 38137 | 102.3 |
| Lithuania | 4465 | 2722291 | 164.0 |
| Luxembourg | 823 | 625976 | 131.5 |
| MS Zaandam | 0 | 0 | NaN |
| Madagascar | 37 | 27691019 | 0.1 |
| Malawi | 62 | 19129955 | 0.3 |
| Malaysia | 2804 | 32365998 | 8.7 |
| Maldives | 9 | 540542 | 1.7 |
| Mali | 138 | 20250834 | 0.7 |
| Malta | 229 | 441539 | 51.9 |
| Marshall Islands | 20 | 58413 | 34.2 |
| Mauritania | 1 | 4649660 | 0.0 |
| Mauritius | 279 | 1271767 | 21.9 |
| Mexico | 40875 | 127792286 | 32.0 |
| Micronesia | 277 | 113815 | 243.4 |
| Moldova | 6534 | 4027690 | 162.2 |
| Monaco | 13 | 39244 | 33.1 |
| Mongolia | 2 | 3278292 | 0.1 |
| Montenegro | 1071 | 628062 | 170.5 |
| Morocco | 104 | 36910558 | 0.3 |
| Mozambique | 0 | 31255435 | 0.0 |
| Namibia | 97 | 2540916 | 3.8 |
| Nauru | 0 | 10834 | 0.0 |
| Nepal | 14 | 29136808 | 0.0 |
| Netherlands | 8486 | 17134873 | 49.5 |
| New Zealand | 20545 | 4822233 | 426.0 |
| Nicaragua | 11 | 6624554 | 0.2 |
| Niger | 0 | 24206636 | 0.0 |
| Nigeria | 135 | 206139587 | 0.1 |
| North Macedonia | 119 | 2083380 | 5.7 |
| Norway | 662 | 5421242 | 12.2 |
| Oman | 0 | 5106622 | 0.0 |
| Pakistan | 507 | 220892331 | 0.2 |
| Palau | 1 | 18008 | 5.6 |
| Panama | 1073 | 4314768 | 24.9 |
| Papua New Guinea | 17 | 8947027 | 0.2 |
| Paraguay | 948 | 7132530 | 13.3 |
| Peru | 2124 | 32971846 | 6.4 |
| Philippines | 1564 | 109581085 | 1.4 |
| Poland | 32154 | 37846605 | 85.0 |
| Portugal | 1376 | 10196707 | 13.5 |
| Qatar | 1247 | 2881060 | 43.3 |
| Romania | 10915 | 19237682 | 56.7 |
| Russia | 173179 | 145934460 | 118.7 |
| Rwanda | 10 | 12952209 | 0.1 |
| Saint Kitts and Nevis | 1 | 53192 | 1.9 |
| Saint Lucia | 122 | 183629 | 66.4 |
| Saint Vincent and the Grenadines | 0 | 110947 | 0.0 |
| Samoa | 13 | 196130 | 6.6 |
| San Marino | 62 | 33938 | 182.7 |
| Sao Tome and Principe | 1 | 219161 | 0.5 |
| Saudi Arabia | 899 | 34813867 | 2.6 |
| Senegal | 11 | 16743930 | 0.1 |
| Serbia | 11423 | 8737370 | 130.7 |
| Seychelles | 0 | 98340 | 0.0 |
| Sierra Leone | 0 | 7976985 | 0.0 |
| Singapore | 8862 | 5850343 | 151.5 |
| Slovakia | 2807 | 5434712 | 51.6 |
| Slovenia | 4385 | 2078932 | 210.9 |
| Solomon Islands | 0 | 652858 | 0.0 |
| Somalia | 0 | 15893219 | 0.0 |
| South Africa | 4772 | 59308690 | 8.0 |
| South Sudan | 0 | 11193729 | 0.0 |
| Spain | 14473 | 46754783 | 31.0 |
| Sri Lanka | 12 | 21413250 | 0.1 |
| Sudan | 34 | 43849269 | 0.1 |
| Summer Olympics 2020 | 0 | 0 | NaN |
| Suriname | 240 | 586634 | 40.9 |
| Sweden | 1376 | 10099270 | 13.6 |
| Switzerland | 2611 | 8654618 | 30.2 |
| Syria | 4 | 17500657 | 0.0 |
| Taiwan* | 33721 | 23816775 | 141.6 |
| Tajikistan | 0 | 9537642 | 0.0 |
| Tanzania | 71 | 59734213 | 0.1 |
| Thailand | 351 | 69799978 | 0.5 |
| Timor-Leste | 0 | 1318442 | 0.0 |
| Togo | 28 | 8278737 | 0.3 |
| Tonga | 6 | 105697 | 5.7 |
| Trinidad and Tobago | 785 | 1399491 | 56.1 |
| Tunisia | 356 | 11818618 | 3.0 |
| Turkey | 0 | 84339067 | 0.0 |
| Tuvalu | 0 | 11792 | 0.0 |
| US | 519271 | 329466283 | 157.6 |
| Uganda | 26 | 45741000 | 0.1 |
| Ukraine | 8745 | 43733759 | 20.0 |
| United Arab Emirates | 1502 | 9890400 | 15.2 |
| United Kingdom | 55023 | 67886004 | 81.1 |
| Uruguay | 257 | 3473727 | 7.4 |
| Uzbekistan | 198 | 33469199 | 0.6 |
| Vanuatu | 0 | 292680 | 0.0 |
| Venezuela | 214 | 28435943 | 0.8 |
| Vietnam | 141 | 97338583 | 0.1 |
| West Bank and Gaza | 0 | 5101416 | 0.0 |
| Winter Olympics 2022 | 0 | 0 | NaN |
| Yemen | 0 | 29825968 | 0.0 |
| Zambia | 411 | 18383956 | 2.2 |
| Zimbabwe | 485 | 14862927 | 3.3 |
Table sorted by 14-day-incidence¶
In [4]:
cases_incidence.sort_values(by=['14-day-incidence-rate'], ascending=False)
Out[4]:
| 14-day-sum | population | 14-day-incidence-rate | |
|---|---|---|---|
| Country | |||
| Austria | 76997 | 9006400 | 854.9 |
| New Zealand | 20545 | 4822233 | 426.0 |
| Cyprus | 3654 | 1207361 | 302.6 |
| Brunei | 1257 | 437483 | 287.3 |
| Korea, South | 135724 | 51269183 | 264.7 |
| Bahrain | 4492 | 1701583 | 264.0 |
| Micronesia | 277 | 113815 | 243.4 |
| Germany | 192740 | 83155031 | 231.8 |
| Slovenia | 4385 | 2078932 | 210.9 |
| Costa Rica | 9580 | 5094114 | 188.1 |
| San Marino | 62 | 33938 | 182.7 |
| Montenegro | 1071 | 628062 | 170.5 |
| Belgium | 19522 | 11492641 | 169.9 |
| Chile | 31734 | 19116209 | 166.0 |
| Lithuania | 4465 | 2722291 | 164.0 |
| Moldova | 6534 | 4027690 | 162.2 |
| US | 519271 | 329466283 | 157.6 |
| Singapore | 8862 | 5850343 | 151.5 |
| Australia | 37836 | 25459700 | 148.6 |
| Taiwan* | 33721 | 23816775 | 141.6 |
| Japan | 166539 | 126476458 | 131.7 |
| Luxembourg | 823 | 625976 | 131.5 |
| Serbia | 11423 | 8737370 | 130.7 |
| Czechia | 12966 | 10708982 | 121.1 |
| Russia | 173179 | 145934460 | 118.7 |
| Liechtenstein | 39 | 38137 | 102.3 |
| Italy | 56096 | 60461828 | 92.8 |
| Georgia | 3553 | 3989175 | 89.1 |
| Poland | 32154 | 37846605 | 85.0 |
| Israel | 7215 | 8655541 | 83.4 |
| United Kingdom | 55023 | 67886004 | 81.1 |
| France | 52120 | 65249843 | 79.9 |
| Barbados | 211 | 287371 | 73.4 |
| Saint Lucia | 122 | 183629 | 66.4 |
| Romania | 10915 | 19237682 | 56.7 |
| Trinidad and Tobago | 785 | 1399491 | 56.1 |
| Malta | 229 | 441539 | 51.9 |
| Slovakia | 2807 | 5434712 | 51.6 |
| Iceland | 172 | 341250 | 50.4 |
| Netherlands | 8486 | 17134873 | 49.5 |
| Canada | 18299 | 38246108 | 47.8 |
| Estonia | 580 | 1326539 | 43.7 |
| Qatar | 1247 | 2881060 | 43.3 |
| Brazil | 88371 | 212559409 | 41.6 |
| Suriname | 240 | 586634 | 40.9 |
| Marshall Islands | 20 | 58413 | 34.2 |
| Monaco | 13 | 39244 | 33.1 |
| Mexico | 40875 | 127792286 | 32.0 |
| Spain | 14473 | 46754783 | 31.0 |
| Switzerland | 2611 | 8654618 | 30.2 |
| Ireland | 1327 | 4937796 | 26.9 |
| Denmark | 1532 | 5837213 | 26.2 |
| Finland | 1393 | 5540718 | 25.1 |
| Panama | 1073 | 4314768 | 24.9 |
| Mauritius | 279 | 1271767 | 21.9 |
| Lebanon | 1477 | 6825442 | 21.6 |
| Kosovo | 373 | 1810366 | 20.6 |
| Ukraine | 8745 | 43733759 | 20.0 |
| Guatemala | 3506 | 17915567 | 19.6 |
| Hungary | 1824 | 9660350 | 18.9 |
| Latvia | 340 | 1886202 | 18.0 |
| Croatia | 722 | 4105268 | 17.6 |
| Armenia | 487 | 2963234 | 16.4 |
| United Arab Emirates | 1502 | 9890400 | 15.2 |
| Bolivia | 1766 | 11673029 | 15.1 |
| Kuwait | 598 | 4270563 | 14.0 |
| Bulgaria | 944 | 6948445 | 13.6 |
| Sweden | 1376 | 10099270 | 13.6 |
| Portugal | 1376 | 10196707 | 13.5 |
| Paraguay | 948 | 7132530 | 13.3 |
| Norway | 662 | 5421242 | 12.2 |
| Andorra | 9 | 77265 | 11.6 |
| Malaysia | 2804 | 32365998 | 8.7 |
| South Africa | 4772 | 59308690 | 8.0 |
| Uruguay | 257 | 3473727 | 7.4 |
| Honduras | 693 | 9904608 | 7.0 |
| Samoa | 13 | 196130 | 6.6 |
| Kazakhstan | 1219 | 18776707 | 6.5 |
| Peru | 2124 | 32971846 | 6.4 |
| Eswatini | 68 | 1160164 | 5.9 |
| North Macedonia | 119 | 2083380 | 5.7 |
| Tonga | 6 | 105697 | 5.7 |
| Palau | 1 | 18008 | 5.6 |
| Iran | 3940 | 83992953 | 4.7 |
| Jamaica | 131 | 2961161 | 4.4 |
| Belize | 17 | 397621 | 4.3 |
| Albania | 112 | 2877800 | 3.9 |
| Namibia | 97 | 2540916 | 3.8 |
| Azerbaijan | 372 | 10139175 | 3.7 |
| Argentina | 1649 | 45195777 | 3.6 |
| Colombia | 1764 | 50882884 | 3.5 |
| Zimbabwe | 485 | 14862927 | 3.3 |
| Bosnia and Herzegovina | 109 | 3280815 | 3.3 |
| Ecuador | 543 | 17643060 | 3.1 |
| Tunisia | 356 | 11818618 | 3.0 |
| Guyana | 23 | 786559 | 2.9 |
| Botswana | 65 | 2351625 | 2.8 |
| Saudi Arabia | 899 | 34813867 | 2.6 |
| Fiji | 21 | 896444 | 2.3 |
| Zambia | 411 | 18383956 | 2.2 |
| Dominican Republic | 213 | 10847904 | 2.0 |
| Saint Kitts and Nevis | 1 | 53192 | 1.9 |
| Maldives | 9 | 540542 | 1.7 |
| Philippines | 1564 | 109581085 | 1.4 |
| Bhutan | 9 | 771612 | 1.2 |
| Indonesia | 2969 | 273523621 | 1.1 |
| Kyrgyzstan | 62 | 6524191 | 1.0 |
| Cabo Verde | 5 | 555988 | 0.9 |
| Kiribati | 1 | 117606 | 0.9 |
| Venezuela | 214 | 28435943 | 0.8 |
| Mali | 138 | 20250834 | 0.7 |
| Cuba | 78 | 11326616 | 0.7 |
| Uzbekistan | 198 | 33469199 | 0.6 |
| Afghanistan | 253 | 38928341 | 0.6 |
| Liberia | 25 | 5057677 | 0.5 |
| Haiti | 59 | 11402533 | 0.5 |
| Comoros | 4 | 869595 | 0.5 |
| Cote d'Ivoire | 132 | 26378275 | 0.5 |
| Sao Tome and Principe | 1 | 219161 | 0.5 |
| Equatorial Guinea | 7 | 1402985 | 0.5 |
| Thailand | 351 | 69799978 | 0.5 |
| Guinea-Bissau | 7 | 1967998 | 0.4 |
| Malawi | 62 | 19129955 | 0.3 |
| Togo | 28 | 8278737 | 0.3 |
| Angola | 93 | 32866268 | 0.3 |
| Morocco | 104 | 36910558 | 0.3 |
| Nicaragua | 11 | 6624554 | 0.2 |
| Ghana | 49 | 31072945 | 0.2 |
| Burundi | 22 | 11890781 | 0.2 |
| Libya | 16 | 6871287 | 0.2 |
| India | 3235 | 1380004385 | 0.2 |
| Cameroon | 64 | 26545864 | 0.2 |
| Pakistan | 507 | 220892331 | 0.2 |
| Ethiopia | 188 | 114963583 | 0.2 |
| Papua New Guinea | 17 | 8947027 | 0.2 |
| Vietnam | 141 | 97338583 | 0.1 |
| Tanzania | 71 | 59734213 | 0.1 |
| Uganda | 26 | 45741000 | 0.1 |
| Sri Lanka | 12 | 21413250 | 0.1 |
| Bangladesh | 91 | 164689383 | 0.1 |
| Algeria | 51 | 43851043 | 0.1 |
| Cambodia | 11 | 16718971 | 0.1 |
| Sudan | 34 | 43849269 | 0.1 |
| Burma | 46 | 54409794 | 0.1 |
| Senegal | 11 | 16743930 | 0.1 |
| Congo (Brazzaville) | 4 | 5518092 | 0.1 |
| Rwanda | 10 | 12952209 | 0.1 |
| Nigeria | 135 | 206139587 | 0.1 |
| Kenya | 45 | 53771300 | 0.1 |
| Laos | 8 | 7275556 | 0.1 |
| Madagascar | 37 | 27691019 | 0.1 |
| Congo (Kinshasa) | 103 | 89561404 | 0.1 |
| Mongolia | 2 | 3278292 | 0.1 |
| Egypt | 0 | 102334403 | 0.0 |
| Antigua and Barbuda | 0 | 97928 | 0.0 |
| Benin | 0 | 12123198 | 0.0 |
| Belarus | 0 | 9449321 | 0.0 |
| Guinea | 0 | 13132792 | 0.0 |
| Turkey | 0 | 84339067 | 0.0 |
| Tuvalu | 0 | 11792 | 0.0 |
| Mauritania | 1 | 4649660 | 0.0 |
| Chad | 3 | 16425859 | 0.0 |
| Bahamas | 0 | 393248 | 0.0 |
| Holy See | 0 | 809 | 0.0 |
| Timor-Leste | 0 | 1318442 | 0.0 |
| Lesotho | 0 | 2142252 | 0.0 |
| Iraq | 0 | 40222503 | 0.0 |
| Vanuatu | 0 | 292680 | 0.0 |
| Jordan | 0 | 10203140 | 0.0 |
| China | 3 | 1411778724 | 0.0 |
| West Bank and Gaza | 0 | 5101416 | 0.0 |
| Yemen | 0 | 29825968 | 0.0 |
| Saint Vincent and the Grenadines | 0 | 110947 | 0.0 |
| Grenada | 0 | 112519 | 0.0 |
| Greece | 0 | 10423056 | 0.0 |
| Central African Republic | 0 | 4829764 | 0.0 |
| South Sudan | 0 | 11193729 | 0.0 |
| Seychelles | 0 | 98340 | 0.0 |
| Sierra Leone | 0 | 7976985 | 0.0 |
| Oman | 0 | 5106622 | 0.0 |
| El Salvador | 0 | 6486201 | 0.0 |
| Dominica | 0 | 71991 | 0.0 |
| Solomon Islands | 0 | 652858 | 0.0 |
| Somalia | 0 | 15893219 | 0.0 |
| Niger | 0 | 24206636 | 0.0 |
| Eritrea | 0 | 3546427 | 0.0 |
| Gambia | 0 | 2416664 | 0.0 |
| Nepal | 14 | 29136808 | 0.0 |
| Nauru | 0 | 10834 | 0.0 |
| Burkina Faso | 0 | 20903278 | 0.0 |
| Mozambique | 0 | 31255435 | 0.0 |
| Gabon | 0 | 2225728 | 0.0 |
| Syria | 4 | 17500657 | 0.0 |
| Djibouti | 0 | 988002 | 0.0 |
| Tajikistan | 0 | 9537642 | 0.0 |
| Korea, North | 0 | 25778815 | 0.0 |
| Antarctica | 0 | 0 | NaN |
| Diamond Princess | 0 | 0 | NaN |
| MS Zaandam | 0 | 0 | NaN |
| Summer Olympics 2020 | 0 | 0 | NaN |
| Winter Olympics 2022 | 0 | 0 | NaN |
Tutorial: Detailed calculation for one country¶
In [5]:
from oscovida import fetch_cases, get_population
import datetime
In [6]:
period = 14 # Days we compute the incidence rate over
In [7]:
cases = fetch_cases() # Get a DataFrame where each row is the country, and columns cumulative case numbers
cases = cases.groupby(cases.index).sum() # Merge the rows for different regions as we want the numbers for an entire country
/tmp/ipykernel_991088/1570404713.py:2: FutureWarning: The default value of numeric_only in DataFrameGroupBy.sum is deprecated. In a future version, numeric_only will default to False. Either specify numeric_only or select only columns which should be valid for the function. cases = cases.groupby(cases.index).sum() # Merge the rows for different regions as we want the numbers for an entire country
In [8]:
cases_germany = cases.loc['Germany'][2:] # First 2 entries are lat/lon so we only take the subsequent ones
cases_germany.tail()
Out[8]:
3/2/23 38202571.0 3/3/23 38210850.0 3/4/23 38210850.0 3/5/23 38210851.0 3/6/23 38210851.0 Name: Germany, dtype: float64
In [9]:
yesterday = datetime.datetime.now() - datetime.timedelta(days=1)
x_days_ago = yesterday - datetime.timedelta(days=period)
In [10]:
period_mask = (
(yesterday > pd.to_datetime(cases_germany.index)) &
(pd.to_datetime(cases_germany.index) > x_days_ago)
) # Mask for dates between today and x days ago
In [11]:
cases_in_period_per_day_germany = cases_germany[period_mask].diff() # Apply the period mask and get the diff to get the daily new cases
cases_in_period_per_day_germany
Out[11]:
2/21/23 NaN 2/22/23 25038.0 2/23/23 21177.0 2/24/23 20974.0 2/25/23 0.0 2/26/23 0.0 2/27/23 32970.0 2/28/23 24875.0 3/1/23 21046.0 3/2/23 12617.0 3/3/23 8279.0 3/4/23 0.0 3/5/23 1.0 3/6/23 0.0 Name: Germany, dtype: float64
In [12]:
cases_in_period_per_day_germany.plot() # We can easily look at new cases per day
Out[12]:
<Axes: >
In [13]:
population = get_population().population
In [14]:
population_germany = population.loc['Germany'] # Get the population of Germany
population_germany
Out[14]:
83155031.0
In [15]:
incidence_rate_germany = cases_in_period_per_day_germany.sum() / population_germany * 100_000
incidence_rate_germany # By convention this is total cases over period / population * 100_000
Out[15]:
200.80204167081604
In [ ]: