Newer
Older
Chandrasekhar Ramakrishnan
committed
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"papermill": {
"duration": 0.609203,
"end_time": "2020-03-21T08:21:34.856967",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-21T08:21:34.247764",
Chandrasekhar Ramakrishnan
committed
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"import pandas as pd\n",
Chandrasekhar Ramakrishnan
committed
"import os\n",
"from IPython.display import display, HTML, Markdown\n",
"import covid_19_dashboard as helper"
Chandrasekhar Ramakrishnan
committed
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"papermill": {
"duration": 0.022235,
"end_time": "2020-03-21T08:21:34.894425",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-21T08:21:34.872190",
Chandrasekhar Ramakrishnan
committed
"status": "completed"
},
"tags": [
"parameters"
]
},
"outputs": [],
"source": [
"ts_folder = \"../data/covid-19_jhu-csse/\"\n",
"rates_folder = \"../data/covid-19_rates/\"\n",
Chandrasekhar Ramakrishnan
committed
"geodata_path = \"../data/geodata/geo_data.csv\"\n",
Chandrasekhar Ramakrishnan
committed
"out_folder = None\n",
"PAPERMILL_OUTPUT_PATH = None"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"papermill": {
"duration": 0.022115,
"end_time": "2020-03-21T08:21:34.927671",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-21T08:21:34.905556",
Chandrasekhar Ramakrishnan
committed
"status": "completed"
},
"tags": [
"injected-parameters"
]
},
"outputs": [],
"source": [
"# Parameters\n",
"PAPERMILL_INPUT_PATH = \"/tmp/t7uqe0kc/notebooks/Dashboard.ipynb\"\n",
Chandrasekhar Ramakrishnan
committed
"PAPERMILL_OUTPUT_PATH = \"runs/Dashboard.run.ipynb\"\n",
"ts_folder = \"/tmp/t7uqe0kc/data/covid-19_jhu-csse\"\n",
"rates_folder = \"/tmp/t7uqe0kc/data/covid-19_rates\"\n",
"geodata_path = \"/tmp/t7uqe0kc/data/geodata/geo_data.csv\"\n"
Chandrasekhar Ramakrishnan
committed
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"papermill": {
"duration": 0.023145,
"end_time": "2020-03-21T08:21:34.964505",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-21T08:21:34.941360",
Chandrasekhar Ramakrishnan
committed
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"# Read in the data"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"papermill": {
"duration": 0.267358,
"end_time": "2020-03-21T08:21:35.246180",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-21T08:21:34.978822",
Chandrasekhar Ramakrishnan
committed
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"jhu_frames_map = helper.read_jhu_frames_map(ts_folder)\n",
"rates_frames_map = helper.read_rates_frames_map(rates_folder)\n",
"geodata_df = helper.read_geodata(geodata_path)\n",
Chandrasekhar Ramakrishnan
committed
"\n",
"# Identify countries with 100 or more cases\n",
"countries_over_thresh = helper.countries_with_number_of_cases(jhu_frames_map, 'confirmed', 100)\n",
"# Filter out some countries with very high case/population ratio\n",
"countries_over_thresh = [c for c in countries_over_thresh if c not in set(['San Marino', 'Iceland'])]"
Chandrasekhar Ramakrishnan
committed
]
},
{
"cell_type": "markdown",
"metadata": {
"papermill": {
"duration": 0.012804,
"end_time": "2020-03-21T08:21:35.273057",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-21T08:21:35.260253",
Chandrasekhar Ramakrishnan
committed
"status": "completed"
},
"tags": []
},
"source": [
"# Questions About COVID-19 and Its Spread\n",
"\n",
Chandrasekhar Ramakrishnan
committed
"Understanding the spread, distribution, and deadliness of COVID-19 is difficult, despite the data available about it. Differences in rates of testing, quality of data, demographics, etc. make it difficult to compare data between countries. \n",
"\n",
"All this needs to be considered when looking at the plots below. But despite those caveats, I found it helpful to plot the raw data, even though direct comparisons between countries might not be inaccurate."
Chandrasekhar Ramakrishnan
committed
]
},
{
"cell_type": "code",
Chandrasekhar Ramakrishnan
committed
"metadata": {
"papermill": {
"duration": 0.035757,
"end_time": "2020-03-21T08:21:35.321446",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-21T08:21:35.285689",
Chandrasekhar Ramakrishnan
committed
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/html": [
"<em>Data up to Mar 20 2020; countries with 100 or more confirmed cases.</em>"
Chandrasekhar Ramakrishnan
committed
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"data_ts = jhu_frames_map['confirmed'].iloc[:,-1].name.strftime(\"%b %d %Y\")\n",
Chandrasekhar Ramakrishnan
committed
"display(HTML(f\"<em>Data up to {data_ts}; countries with 100 or more confirmed cases.</em>\"))"
Chandrasekhar Ramakrishnan
committed
]
},
{
"cell_type": "markdown",
"metadata": {
"papermill": {
"duration": 0.012885,
"end_time": "2020-03-21T08:21:35.350882",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-21T08:21:35.337997",
Chandrasekhar Ramakrishnan
committed
"status": "completed"
},
"tags": []
},
"source": [
"## How are cases per 100,000 distributed geographically?"
]
},
{
"cell_type": "code",
Chandrasekhar Ramakrishnan
committed
"metadata": {
"papermill": {
"duration": 0.023769,
"end_time": "2020-03-21T08:21:35.387608",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-21T08:21:35.363839",
Chandrasekhar Ramakrishnan
committed
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
Chandrasekhar Ramakrishnan
committed
]
},
{
"cell_type": "code",
Chandrasekhar Ramakrishnan
committed
"metadata": {
"papermill": {
"duration": 0.05008,
"end_time": "2020-03-21T08:21:35.451869",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-21T08:21:35.401789",
Chandrasekhar Ramakrishnan
committed
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"map_df = helper.compute_map_df(rates_frames_map, jhu_frames_map, geodata_df, countries_over_thresh)"
Chandrasekhar Ramakrishnan
committed
]
},
{
"cell_type": "code",
Chandrasekhar Ramakrishnan
committed
"metadata": {
"papermill": {
"duration": 0.131073,
"end_time": "2020-03-21T08:21:35.596614",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-21T08:21:35.465541",
Chandrasekhar Ramakrishnan
committed
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"<div id=\"altair-viz-41e64d099e4d4eeba58793013e400089\"></div>\n",
Chandrasekhar Ramakrishnan
committed
"<script type=\"text/javascript\">\n",
" (function(spec, embedOpt){\n",
" const outputDiv = document.getElementById(\"altair-viz-41e64d099e4d4eeba58793013e400089\");\n",
Chandrasekhar Ramakrishnan
committed
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
" const paths = {\n",
" \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
" \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
" \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
" \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
" };\n",
"\n",
" function loadScript(lib) {\n",
" return new Promise(function(resolve, reject) {\n",
" var s = document.createElement('script');\n",
" s.src = paths[lib];\n",
" s.async = true;\n",
" s.onload = () => resolve(paths[lib]);\n",
" s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
" document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
" });\n",
" }\n",
"\n",
" function showError(err) {\n",
" outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
" throw err;\n",
" }\n",
"\n",
" function displayChart(vegaEmbed) {\n",
" vegaEmbed(outputDiv, spec, embedOpt)\n",
" .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
" }\n",
"\n",
" if(typeof define === \"function\" && define.amd) {\n",
" requirejs.config({paths});\n",
" require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
" } else if (typeof vegaEmbed === \"function\") {\n",
" displayChart(vegaEmbed);\n",
" } else {\n",
" loadScript(\"vega\")\n",
" .then(() => loadScript(\"vega-lite\"))\n",
" .then(() => loadScript(\"vega-embed\"))\n",
" .catch(showError)\n",
" .then(() => displayChart(vegaEmbed));\n",
" }\n",
" })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300, \"stroke\": null}}, \"layer\": [{\"data\": {\"sphere\": true}, \"mark\": {\"type\": \"geoshape\", \"fill\": \"#cae6ef\"}}, {\"data\": {\"graticule\": true}, \"mark\": {\"type\": \"geoshape\", \"stroke\": \"white\", \"strokeWidth\": 0.5}}, {\"data\": {\"url\": \"https://vega.github.io/vega-datasets/data/world-110m.json\", \"format\": {\"feature\": \"countries\", \"type\": \"topojson\"}}, \"mark\": {\"type\": \"geoshape\", \"fill\": \"#dddddd\", \"stroke\": \"#aaaaaa\"}}, {\"data\": {\"name\": \"data-6681b4076a5077dfa2d4c4381a20a4fb\"}, \"mark\": {\"type\": \"circle\", \"opacity\": 0.6}, \"encoding\": {\"color\": {\"value\": \"steelblue\"}, \"latitude\": {\"field\": \"Lat\", \"type\": \"quantitative\"}, \"longitude\": {\"field\": \"Long\", \"type\": \"quantitative\"}, \"size\": {\"type\": \"quantitative\", \"field\": \"Confirmed/100k\", \"title\": \"Cases\"}, \"tooltip\": [{\"type\": \"nominal\", \"field\": \"Country/Region\"}, {\"type\": \"quantitative\", \"field\": \"Confirmed\"}, {\"type\": \"quantitative\", \"field\": \"Deaths\"}, {\"type\": \"quantitative\", \"field\": \"Recovered\"}, {\"type\": \"quantitative\", \"field\": \"Confirmed/100k\"}, {\"type\": \"quantitative\", \"field\": \"Deaths/100k\"}, {\"type\": \"quantitative\", \"field\": \"Recovered/100k\"}]}}], \"height\": 400, \"projection\": {\"type\": \"naturalEarth1\"}, \"title\": \"Confirmed cases per 100k inhabitants\", \"width\": 600, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-6681b4076a5077dfa2d4c4381a20a4fb\": [{\"Country/Region\": \"Argentina\", \"Confirmed/100k\": 0.21800446266372414, \"Deaths/100k\": 0.006742406061764665, \"Recovered/100k\": 0.006742406061764665, \"Confirmed\": 128.0, \"Deaths\": 3.0, \"Recovered\": 3.0, \"Long\": -65.17980692, \"Lat\": -35.3813488}, {\"Country/Region\": \"Armenia\", \"Confirmed/100k\": 3.895959585009161, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.03387790943486227, \"Confirmed\": 136.0, \"Deaths\": 0.0, \"Recovered\": 1.0, \"Long\": 44.92993276, \"Lat\": 40.28952569}, {\"Country/Region\": \"Australia\", \"Confirmed/100k\": 2.724831727636544, \"Deaths/100k\": 0.024007327996797743, \"Recovered/100k\": 0.1040317546527902, \"Confirmed\": 791.0, \"Deaths\": 7.0, \"Recovered\": 26.0, \"Long\": 134.49100008, \"Lat\": -25.73288704}, {\"Country/Region\": \"Austria\", \"Confirmed/100k\": 22.753380595107718, \"Deaths/100k\": 0.06781931622982926, \"Recovered/100k\": 0.1017289743447439, \"Confirmed\": 2388.0, \"Deaths\": 6.0, \"Recovered\": 9.0, \"Long\": 14.1264761, \"Lat\": 47.58549439}, {\"Country/Region\": \"Bahrain\", \"Confirmed/100k\": 17.713335784315287, \"Deaths/100k\": 0.06371703519537872, \"Recovered/100k\": 6.371703519537872, \"Confirmed\": 285.0, \"Deaths\": 1.0, \"Recovered\": 100.0, \"Long\": 50.54196932, \"Lat\": 26.04205135}, {\"Country/Region\": \"Belgium\", \"Confirmed/100k\": 15.715192730423247, \"Deaths/100k\": 0.1838546224729182, \"Recovered/100k\": 0.27140444269811737, \"Confirmed\": 2257.0, \"Deaths\": 37.0, \"Recovered\": 1.0, \"Long\": 4.64065114, \"Lat\": 50.63981576}, {\"Country/Region\": \"Brazil\", \"Confirmed/100k\": 0.29646344460360696, \"Deaths/100k\": 0.0028643811072812265, \"Recovered/100k\": 0.0009547937024270756, \"Confirmed\": 793.0, \"Deaths\": 11.0, \"Recovered\": 2.0, \"Long\": -53.09783113, \"Lat\": -10.78777702}, {\"Country/Region\": \"Bulgaria\", \"Confirmed/100k\": 1.3382276399245123, \"Deaths/100k\": 0.04270939276354828, \"Recovered/100k\": 0.0, \"Confirmed\": 127.0, \"Deaths\": 3.0, \"Recovered\": 0.0, \"Long\": 25.21552909, \"Lat\": 42.76890318}, {\"Country/Region\": \"Canada\", \"Confirmed/100k\": 2.1587282672730104, \"Deaths/100k\": 0.02428569300682137, \"Recovered/100k\": 0.02428569300682137, \"Confirmed\": 943.0, \"Deaths\": 12.0, \"Recovered\": 9.0, \"Long\": -98.30777028, \"Lat\": 61.36206324}, {\"Country/Region\": \"Chile\", \"Confirmed/100k\": 1.2707457248483114, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.0, \"Confirmed\": 434.0, \"Deaths\": 0.0, \"Recovered\": 6.0, \"Long\": -71.38256213, \"Lat\": -37.73070989}, {\"Country/Region\": \"China\", \"Confirmed/100k\": 5.827116526534216, \"Deaths/100k\": 0.2332828329970633, \"Recovered/100k\": 5.064513581239722, \"Confirmed\": 81250.0, \"Deaths\": 3253.0, \"Recovered\": 71266.0, \"Long\": 103.81907349, \"Lat\": 36.56176546}, {\"Country/Region\": \"Colombia\", \"Confirmed/100k\": 0.20544350771828093, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.002014152036453735, \"Confirmed\": 128.0, \"Deaths\": 0.0, \"Recovered\": 1.0, \"Long\": -73.08114582, \"Lat\": 3.91383431}, {\"Country/Region\": \"Croatia\", \"Confirmed/100k\": 2.567613830879836, \"Deaths/100k\": 0.02445346505599844, \"Recovered/100k\": 0.12226732527999218, \"Confirmed\": 128.0, \"Deaths\": 1.0, \"Recovered\": 5.0, \"Long\": 16.40412899, \"Lat\": 45.08047631}, {\"Country/Region\": \"Czechia\", \"Confirmed/100k\": 6.531337479571924, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.028233447318034257, \"Confirmed\": 833.0, \"Deaths\": 0.0, \"Recovered\": 4.0, \"Long\": 15.31240163, \"Lat\": 49.73341233}, {\"Country/Region\": \"Denmark\", \"Confirmed/100k\": 21.12999413879836, \"Deaths/100k\": 0.10349384884309402, \"Recovered/100k\": 0.01724897480718234, \"Confirmed\": 1337.0, \"Deaths\": 9.0, \"Recovered\": 1.0, \"Long\": 10.02800992, \"Lat\": 55.98125296}, {\"Country/Region\": \"Ecuador\", \"Confirmed/100k\": 1.1648082511972797, \"Deaths/100k\": 0.01755992338488361, \"Recovered/100k\": 0.0, \"Confirmed\": 367.0, \"Deaths\": 5.0, \"Recovered\": 0.0, \"Long\": -78.75201922, \"Lat\": -1.42381612}, {\"Country/Region\": \"Egypt\", \"Confirmed/100k\": 0.2601002330792733, \"Deaths/100k\": 0.0060960992127954685, \"Recovered/100k\": 0.032512529134909166, \"Confirmed\": 285.0, \"Deaths\": 8.0, \"Recovered\": 39.0, \"Long\": 29.86190099, \"Lat\": 26.49593311}, {\"Country/Region\": \"Estonia\", \"Confirmed/100k\": 20.213735649761826, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.07570687509274092, \"Confirmed\": 283.0, \"Deaths\": 0.0, \"Recovered\": 1.0, \"Long\": 25.54248537, \"Lat\": 58.67192972}, {\"Country/Region\": \"Finland\", \"Confirmed/100k\": 7.248937577586285, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.18122343943965716, \"Confirmed\": 450.0, \"Deaths\": 0.0, \"Recovered\": 10.0, \"Long\": 26.2746656, \"Lat\": 64.49884603}, {\"Country/Region\": \"France\", \"Confirmed/100k\": 16.341917276071243, \"Deaths/100k\": 0.3627556315050071, \"Recovered/100k\": 0.017913858345926282, \"Confirmed\": 12726.0, \"Deaths\": 450.0, \"Recovered\": 12.0, \"Long\": -2.76172945, \"Lat\": 42.17344011}, {\"Country/Region\": \"Germany\", \"Confirmed/100k\": 18.473874215731584, \"Deaths/100k\": 0.05305812437938575, \"Recovered/100k\": 0.13626291033796795, \"Confirmed\": 19848.0, \"Deaths\": 67.0, \"Recovered\": 180.0, \"Long\": 10.38578051, \"Lat\": 51.10698181}, {\"Country/Region\": \"Greece\", \"Confirmed/100k\": 3.896466594603785, \"Deaths/100k\": 0.055930142506274434, \"Recovered/100k\": 0.07457352334169924, \"Confirmed\": 495.0, \"Deaths\": 6.0, \"Recovered\": 19.0, \"Long\": 22.95555794, \"Lat\": 39.07469623}, {\"Country/Region\": \"India\", \"Confirmed/100k\": 0.01434256356059339, \"Deaths/100k\": 0.00029572296001223485, \"Recovered/100k\": 0.0011089611000458808, \"Confirmed\": 244.0, \"Deaths\": 5.0, \"Recovered\": 20.0, \"Long\": 79.61197609999998, \"Lat\": 22.88578212}, {\"Country/Region\": \"Indonesia\", \"Confirmed/100k\": 0.11619069298725845, \"Deaths/100k\": 0.009340087860712092, \"Recovered/100k\": 0.004109638658713321, \"Confirmed\": 369.0, \"Deaths\": 32.0, \"Recovered\": 15.0, \"Long\": 117.24011366, \"Lat\": -2.21505456}, {\"Country/Region\": \"Iran\", \"Confirmed/100k\": 22.5023709885355, \"Deaths/100k\": 1.569676989693029, \"Recovered/100k\": 6.980417142638004, \"Confirmed\": 19644.0, \"Deaths\": 1433.0, \"Recovered\": 6745.0, \"Long\": 54.27407004, \"Lat\": 32.57503292}, {\"Country/Region\": \"Iraq\", \"Confirmed/100k\": 0.4995628824778319, \"Deaths/100k\": 0.033824570167769866, \"Recovered/100k\": 0.1118812705549311, \"Confirmed\": 208.0, \"Deaths\": 17.0, \"Recovered\": 49.0, \"Long\": 43.74353149, \"Lat\": 33.03970582}, {\"Country/Region\": \"Ireland\", \"Confirmed/100k\": 11.47624006233844, \"Deaths/100k\": 0.06181098776842967, \"Recovered/100k\": 0.10301831294738276, \"Confirmed\": 683.0, \"Deaths\": 3.0, \"Recovered\": 5.0, \"Long\": -8.13793569, \"Lat\": 53.17544870000001}, {\"Country/Region\": \"Israel\", \"Confirmed/100k\": 7.620612800828473, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.12382088745806975, \"Confirmed\": 705.0, \"Deaths\": 0.0, \"Recovered\": 14.0, \"Long\": 35.00444693, \"Lat\": 31.46110101}, {\"Country/Region\": \"Italy\", \"Confirmed/100k\": 67.90357239312625, \"Deaths/100k\": 5.634498939895088, \"Recovered/100k\": 7.347188044973329, \"Confirmed\": 47021.0, \"Deaths\": 4032.0, \"Recovered\": 4440.0, \"Long\": 12.07001339, \"Lat\": 42.79662641}, {\"Country/Region\": \"Japan\", \"Confirmed/100k\": 0.7302667923821476, \"Deaths/100k\": 0.02291962876524057, \"Recovered/100k\": 0.11854980395814085, \"Confirmed\": 963.0, \"Deaths\": 33.0, \"Recovered\": 191.0, \"Long\": 138.03089558, \"Lat\": 37.59230135}, {\"Country/Region\": \"Korea, South\", \"Confirmed/100k\": 16.58750370095967, \"Deaths/100k\": 0.1762361747562557, \"Recovered/100k\": 2.9824583420289423, \"Confirmed\": 8652.0, \"Deaths\": 94.0, \"Recovered\": 1540.0, \"Long\": 127.83916086, \"Lat\": 36.38523983}, {\"Country/Region\": \"Kuwait\", \"Confirmed/100k\": 3.577204409919588, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.4350654012064364, \"Confirmed\": 159.0, \"Deaths\": 0.0, \"Recovered\": 18.0, \"Long\": 47.58700459, \"Lat\": 29.33431262}, {\"Country/Region\": \"Latvia\", \"Confirmed/100k\": 4.4639566643239545, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.05190647284097621, \"Confirmed\": 111.0, \"Deaths\": 0.0, \"Recovered\": 1.0, \"Long\": 24.91235983, \"Lat\": 56.85085163}, {\"Country/Region\": \"Lebanon\", \"Confirmed/100k\": 2.2923305482247214, \"Deaths/100k\": 0.05840332606941965, \"Recovered/100k\": 0.05840332606941965, \"Confirmed\": 163.0, \"Deaths\": 4.0, \"Recovered\": 4.0, \"Long\": 35.88016072, \"Lat\": 33.92306631}, {\"Country/Region\": \"Luxembourg\", \"Confirmed/100k\": 55.123344654187406, \"Deaths/100k\": 0.658189189900745, \"Recovered/100k\": 0.0, \"Confirmed\": 484.0, \"Deaths\": 4.0, \"Recovered\": 0.0, \"Long\": 6.07182201, \"Lat\": 49.76725361}, {\"Country/Region\": \"Malaysia\", \"Confirmed/100k\": 2.8545524640576163, \"Deaths/100k\": 0.0063434499201280355, \"Recovered/100k\": 0.23787937200480136, \"Confirmed\": 1030.0, \"Deaths\": 3.0, \"Recovered\": 87.0, \"Long\": 109.69762284, \"Lat\": 3.78986846}, {\"Country/Region\": \"Mexico\", \"Confirmed/100k\": 0.09350920290631674, \"Deaths/100k\": 0.0007924508720874299, \"Recovered/100k\": 0.0031698034883497197, \"Confirmed\": 164.0, \"Deaths\": 1.0, \"Recovered\": 4.0, \"Long\": -102.52345169, \"Lat\": 23.94753724}, {\"Country/Region\": \"Netherlands\", \"Confirmed/100k\": 14.317204840550039, \"Deaths/100k\": 0.4468685742692959, \"Recovered/100k\": 0.011606975955046644, \"Confirmed\": 3003.0, \"Deaths\": 107.0, \"Recovered\": 2.0, \"Long\": 5.28144793, \"Lat\": 52.1007899}, {\"Country/Region\": \"Norway\", \"Confirmed/100k\": 32.85452782812378, \"Deaths/100k\": 0.131719183732455, \"Recovered/100k\": 0.018817026247493568, \"Confirmed\": 1914.0, \"Deaths\": 7.0, \"Recovered\": 1.0, \"Long\": 15.34834656, \"Lat\": 68.75015572}, {\"Country/Region\": \"Pakistan\", \"Confirmed/100k\": 0.213933951803508, \"Deaths/100k\": 0.0009424403163150133, \"Recovered/100k\": 0.006125862056047585, \"Confirmed\": 501.0, \"Deaths\": 3.0, \"Recovered\": 13.0, \"Long\": 69.33957937, \"Lat\": 29.9497515}, {\"Country/Region\": \"Panama\", \"Confirmed/100k\": 2.609607713713105, \"Deaths/100k\": 0.02394135517167987, \"Recovered/100k\": 0.0, \"Confirmed\": 137.0, \"Deaths\": 1.0, \"Recovered\": 0.0, \"Long\": -80.11915156, \"Lat\": 8.51750797}, {\"Country/Region\": \"Peru\", \"Confirmed/100k\": 0.7314955996475817, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.0031260495711435115, \"Confirmed\": 234.0, \"Deaths\": 3.0, \"Recovered\": 1.0, \"Long\": -74.38242685, \"Lat\": -9.15280381}, {\"Country/Region\": \"Philippines\", \"Confirmed/100k\": 0.2034656253077183, \"Deaths/100k\": 0.01593970336512079, \"Recovered/100k\": 0.007501036877703902, \"Confirmed\": 230.0, \"Deaths\": 18.0, \"Recovered\": 8.0, \"Long\": 122.88393253, \"Lat\": 11.77536778}, {\"Country/Region\": \"Poland\", \"Confirmed/100k\": 0.9347382106340664, \"Deaths/100k\": 0.013165326910338962, \"Recovered/100k\": 0.002633065382067793, \"Confirmed\": 425.0, \"Deaths\": 5.0, \"Recovered\": 1.0, \"Long\": 19.39012835, \"Lat\": 52.12759564}, {\"Country/Region\": \"Portugal\", \"Confirmed/100k\": 7.634878146372187, \"Deaths/100k\": 0.029177878266390532, \"Recovered/100k\": 0.029177878266390532, \"Confirmed\": 1020.0, \"Deaths\": 6.0, \"Recovered\": 5.0, \"Long\": -8.50104361, \"Lat\": 39.59550671}, {\"Country/Region\": \"Qatar\", \"Confirmed/100k\": 16.536786981378498, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.14379814766416085, \"Confirmed\": 470.0, \"Deaths\": 0.0, \"Recovered\": 10.0, \"Long\": 51.18479632, \"Lat\": 25.30601188}, {\"Country/Region\": \"Romania\", \"Confirmed/100k\": 1.4224140410033186, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.12837671850210455, \"Confirmed\": 308.0, \"Deaths\": 0.0, \"Recovered\": 25.0, \"Long\": 24.97293039, \"Lat\": 45.85243127}, {\"Country/Region\": \"Russia\", \"Confirmed/100k\": 0.13773718568322316, \"Deaths/100k\": 0.0006921466617247395, \"Recovered/100k\": 0.006229319955522656, \"Confirmed\": 253.0, \"Deaths\": 1.0, \"Recovered\": 9.0, \"Long\": 96.68656112, \"Lat\": 61.98052209}, {\"Country/Region\": \"Saudi Arabia\", \"Confirmed/100k\": 0.8130576585179794, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.01780418230331341, \"Confirmed\": 344.0, \"Deaths\": 0.0, \"Recovered\": 8.0, \"Long\": 44.53686271, \"Lat\": 24.12245841}, {\"Country/Region\": \"Serbia\", \"Confirmed/100k\": 1.4752042513381391, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.014322371372214943, \"Confirmed\": 135.0, \"Deaths\": 1.0, \"Recovered\": 1.0, \"Long\": 20.78958334, \"Lat\": 44.2215032}, {\"Country/Region\": \"Singapore\", \"Confirmed/100k\": 6.118457595364586, \"Deaths/100k\": 0.0, \"Recovered/100k\": 2.0217512054248195, \"Confirmed\": 385.0, \"Deaths\": 0.0, \"Recovered\": 124.0, \"Long\": 103.81725592, \"Lat\": 1.35876087}, {\"Country/Region\": \"Slovakia\", \"Confirmed/100k\": 2.258119177655415, \"Deaths/100k\": 0.018358692501263537, \"Recovered/100k\": 0.0, \"Confirmed\": 137.0, \"Deaths\": 1.0, \"Recovered\": 0.0, \"Long\": 19.47905218, \"Lat\": 48.70547528}, {\"Country/Region\": \"Slovenia\", \"Confirmed/100k\": 13.833988271099733, \"Deaths/100k\": 0.04837058836048858, \"Recovered/100k\": 0.0, \"Confirmed\": 341.0, \"Deaths\": 1.0, \"Recovered\": 0.0, \"Long\": 14.80444238, \"Lat\": 46.11554772}, {\"Country/Region\": \"South Africa\", \"Confirmed/100k\": 0.25960709815650923, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.0, \"Confirmed\": 202.0, \"Deaths\": 0.0, \"Recovered\": 0.0, \"Long\": 25.08390093, \"Lat\": -29.00034095}, {\"Country/Region\": \"Spain\", \"Confirmed/100k\": 38.445117064557465, \"Deaths/100k\": 1.7763985505529534, \"Recovered/100k\": 2.3692448138097824, \"Confirmed\": 20410.0, \"Deaths\": 1043.0, \"Recovered\": 1588.0, \"Long\": -3.64755047, \"Lat\": 40.24448698}, {\"Country/Region\": \"Sweden\", \"Confirmed/100k\": 14.131152612029155, \"Deaths/100k\": 0.10802131948041746, \"Recovered/100k\": 0.15712191924424354, \"Confirmed\": 1639.0, \"Deaths\": 16.0, \"Recovered\": 16.0, \"Long\": 16.74558049, \"Lat\": 62.77966519}, {\"Country/Region\": \"Switzerland\", \"Confirmed/100k\": 47.84805290127696, \"Deaths/100k\": 0.4814159923809461, \"Recovered/100k\": 0.17612780209059006, \"Confirmed\": 5294.0, \"Deaths\": 54.0, \"Recovered\": 15.0, \"Long\": 8.20867471, \"Lat\": 46.79785878}, {\"Country/Region\": \"Taiwan*\", \"Confirmed/100k\": 0.4700895307274674, \"Deaths/100k\": 0.004352680840069143, \"Recovered/100k\": 0.11316970184179773, \"Confirmed\": 135.0, \"Deaths\": 2.0, \"Recovered\": 26.0, \"Long\": 120.95427281, \"Lat\": 23.7539928}, {\"Country/Region\": \"Thailand\", \"Confirmed/100k\": 0.3917698149538653, \"Deaths/100k\": 0.0014403302020362695, \"Recovered/100k\": 0.06049386848552332, \"Confirmed\": 322.0, \"Deaths\": 1.0, \"Recovered\": 42.0, \"Long\": 101.0028813, \"Lat\": 15.11815794}, {\"Country/Region\": \"Turkey\", \"Confirmed/100k\": 0.2332369335932176, \"Deaths/100k\": 0.003644327087394025, \"Recovered/100k\": 0.0, \"Confirmed\": 359.0, \"Deaths\": 4.0, \"Recovered\": 0.0, \"Long\": 35.16895346, \"Lat\": 39.0616029}, {\"Country/Region\": \"US\", \"Confirmed/100k\": 4.1804283002078995, \"Deaths/100k\": 0.06113077868257511, \"Recovered/100k\": 0.0, \"Confirmed\": 19100.0, \"Deaths\": 244.0, \"Recovered\": 0.0, \"Long\": -112.4616737, \"Lat\": 45.6795472}, {\"Country/Region\": \"United Arab Emirates\", \"Confirmed/100k\": 1.4536454780879038, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.3218786415766073, \"Confirmed\": 140.0, \"Deaths\": 2.0, \"Recovered\": 31.0, \"Long\": 54.3001671, \"Lat\": 23.90528188}, {\"Country/Region\": \"United Kingdom\", \"Confirmed/100k\": 4.084886774714328, \"Deaths/100k\": 0.20755315718357045, \"Recovered/100k\": 0.10076856182100884, \"Confirmed\": 4014.0, \"Deaths\": 178.0, \"Recovered\": 67.0, \"Long\": -2.86563164, \"Lat\": 54.12387156}]}}, {\"mode\": \"vega-lite\"});\n",
Chandrasekhar Ramakrishnan
committed
"</script>"
],
"text/plain": [
"alt.LayerChart(...)"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"\n",
Chandrasekhar Ramakrishnan
committed
"<p style=\"font-size: smaller\">Data Sources: \n",
" <a href=\"https://github.com/CSSEGISandData/COVID-19\">JHU CSSE</a>,\n",
" <a href=\"https://data.worldbank.org/indicator/SP.POP.TOTL\">World Bank</a>,\n",
" <a href=\"https://worldmap.harvard.edu/data/geonode:country_centroids_az8\">Harvard Worldmap</a>\n",
Chandrasekhar Ramakrishnan
committed
"</p>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"display(helper.map_of_variable(map_df, 'Confirmed/100k', 'Confirmed'))\n",
Chandrasekhar Ramakrishnan
committed
"display(HTML('''\n",
Chandrasekhar Ramakrishnan
committed
"<p style=\"font-size: smaller\">Data Sources: \n",
" <a href=\"https://github.com/CSSEGISandData/COVID-19\">JHU CSSE</a>,\n",
" <a href=\"https://data.worldbank.org/indicator/SP.POP.TOTL\">World Bank</a>,\n",
" <a href=\"https://worldmap.harvard.edu/data/geonode:country_centroids_az8\">Harvard Worldmap</a>\n",
Chandrasekhar Ramakrishnan
committed
"</p>'''))"
]
},
{
"cell_type": "code",
Chandrasekhar Ramakrishnan
committed
"metadata": {
"papermill": {
"duration": 0.121229,
"end_time": "2020-03-21T08:21:35.733198",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-21T08:21:35.611969",
Chandrasekhar Ramakrishnan
committed
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"<div id=\"altair-viz-1ee73cb55d3a4a61aed54cbd6a511d94\"></div>\n",
Chandrasekhar Ramakrishnan
committed
"<script type=\"text/javascript\">\n",
" (function(spec, embedOpt){\n",
" const outputDiv = document.getElementById(\"altair-viz-1ee73cb55d3a4a61aed54cbd6a511d94\");\n",
Chandrasekhar Ramakrishnan
committed
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
" const paths = {\n",
" \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
" \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
" \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
" \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
" };\n",
"\n",
" function loadScript(lib) {\n",
" return new Promise(function(resolve, reject) {\n",
" var s = document.createElement('script');\n",
" s.src = paths[lib];\n",
" s.async = true;\n",
" s.onload = () => resolve(paths[lib]);\n",
" s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
" document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
" });\n",
" }\n",
"\n",
" function showError(err) {\n",
" outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
" throw err;\n",
" }\n",
"\n",
" function displayChart(vegaEmbed) {\n",
" vegaEmbed(outputDiv, spec, embedOpt)\n",
" .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
" }\n",
"\n",
" if(typeof define === \"function\" && define.amd) {\n",
" requirejs.config({paths});\n",
" require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
" } else if (typeof vegaEmbed === \"function\") {\n",
" displayChart(vegaEmbed);\n",
" } else {\n",
" loadScript(\"vega\")\n",
" .then(() => loadScript(\"vega-lite\"))\n",
" .then(() => loadScript(\"vega-embed\"))\n",
" .catch(showError)\n",
" .then(() => displayChart(vegaEmbed));\n",
" }\n",
" })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"layer\": [{\"mark\": \"bar\", \"encoding\": {\"tooltip\": [{\"type\": \"nominal\", \"field\": \"Country/Region\"}, {\"type\": \"quantitative\", \"field\": \"Confirmed\"}, {\"type\": \"quantitative\", \"field\": \"Deaths\"}, {\"type\": \"quantitative\", \"field\": \"Recovered\"}, {\"type\": \"quantitative\", \"field\": \"Confirmed/100k\"}, {\"type\": \"quantitative\", \"field\": \"Deaths/100k\"}, {\"type\": \"quantitative\", \"field\": \"Recovered/100k\"}], \"x\": {\"type\": \"quantitative\", \"field\": \"Confirmed/100k\"}, \"y\": {\"type\": \"nominal\", \"field\": \"Country/Region\", \"sort\": \"-x\"}}}, {\"mark\": {\"type\": \"text\", \"align\": \"left\", \"baseline\": \"middle\", \"dx\": 3}, \"encoding\": {\"text\": {\"type\": \"quantitative\", \"field\": \"Confirmed/100k\", \"format\": \".3\"}, \"tooltip\": [{\"type\": \"nominal\", \"field\": \"Country/Region\"}, {\"type\": \"quantitative\", \"field\": \"Confirmed\"}, {\"type\": \"quantitative\", \"field\": \"Deaths\"}, {\"type\": \"quantitative\", \"field\": \"Recovered\"}, {\"type\": \"quantitative\", \"field\": \"Confirmed/100k\"}, {\"type\": \"quantitative\", \"field\": \"Deaths/100k\"}, {\"type\": \"quantitative\", \"field\": \"Recovered/100k\"}], \"x\": {\"type\": \"quantitative\", \"field\": \"Confirmed/100k\"}, \"y\": {\"type\": \"nominal\", \"field\": \"Country/Region\", \"sort\": \"-x\"}}}], \"data\": {\"name\": \"data-6681b4076a5077dfa2d4c4381a20a4fb\"}, \"height\": 900, \"title\": \"Confirmed cases per 100k inhabitants\", \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-6681b4076a5077dfa2d4c4381a20a4fb\": [{\"Country/Region\": \"Argentina\", \"Confirmed/100k\": 0.21800446266372414, \"Deaths/100k\": 0.006742406061764665, \"Recovered/100k\": 0.006742406061764665, \"Confirmed\": 128.0, \"Deaths\": 3.0, \"Recovered\": 3.0, \"Long\": -65.17980692, \"Lat\": -35.3813488}, {\"Country/Region\": \"Armenia\", \"Confirmed/100k\": 3.895959585009161, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.03387790943486227, \"Confirmed\": 136.0, \"Deaths\": 0.0, \"Recovered\": 1.0, \"Long\": 44.92993276, \"Lat\": 40.28952569}, {\"Country/Region\": \"Australia\", \"Confirmed/100k\": 2.724831727636544, \"Deaths/100k\": 0.024007327996797743, \"Recovered/100k\": 0.1040317546527902, \"Confirmed\": 791.0, \"Deaths\": 7.0, \"Recovered\": 26.0, \"Long\": 134.49100008, \"Lat\": -25.73288704}, {\"Country/Region\": \"Austria\", \"Confirmed/100k\": 22.753380595107718, \"Deaths/100k\": 0.06781931622982926, \"Recovered/100k\": 0.1017289743447439, \"Confirmed\": 2388.0, \"Deaths\": 6.0, \"Recovered\": 9.0, \"Long\": 14.1264761, \"Lat\": 47.58549439}, {\"Country/Region\": \"Bahrain\", \"Confirmed/100k\": 17.713335784315287, \"Deaths/100k\": 0.06371703519537872, \"Recovered/100k\": 6.371703519537872, \"Confirmed\": 285.0, \"Deaths\": 1.0, \"Recovered\": 100.0, \"Long\": 50.54196932, \"Lat\": 26.04205135}, {\"Country/Region\": \"Belgium\", \"Confirmed/100k\": 15.715192730423247, \"Deaths/100k\": 0.1838546224729182, \"Recovered/100k\": 0.27140444269811737, \"Confirmed\": 2257.0, \"Deaths\": 37.0, \"Recovered\": 1.0, \"Long\": 4.64065114, \"Lat\": 50.63981576}, {\"Country/Region\": \"Brazil\", \"Confirmed/100k\": 0.29646344460360696, \"Deaths/100k\": 0.0028643811072812265, \"Recovered/100k\": 0.0009547937024270756, \"Confirmed\": 793.0, \"Deaths\": 11.0, \"Recovered\": 2.0, \"Long\": -53.09783113, \"Lat\": -10.78777702}, {\"Country/Region\": \"Bulgaria\", \"Confirmed/100k\": 1.3382276399245123, \"Deaths/100k\": 0.04270939276354828, \"Recovered/100k\": 0.0, \"Confirmed\": 127.0, \"Deaths\": 3.0, \"Recovered\": 0.0, \"Long\": 25.21552909, \"Lat\": 42.76890318}, {\"Country/Region\": \"Canada\", \"Confirmed/100k\": 2.1587282672730104, \"Deaths/100k\": 0.02428569300682137, \"Recovered/100k\": 0.02428569300682137, \"Confirmed\": 943.0, \"Deaths\": 12.0, \"Recovered\": 9.0, \"Long\": -98.30777028, \"Lat\": 61.36206324}, {\"Country/Region\": \"Chile\", \"Confirmed/100k\": 1.2707457248483114, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.0, \"Confirmed\": 434.0, \"Deaths\": 0.0, \"Recovered\": 6.0, \"Long\": -71.38256213, \"Lat\": -37.73070989}, {\"Country/Region\": \"China\", \"Confirmed/100k\": 5.827116526534216, \"Deaths/100k\": 0.2332828329970633, \"Recovered/100k\": 5.064513581239722, \"Confirmed\": 81250.0, \"Deaths\": 3253.0, \"Recovered\": 71266.0, \"Long\": 103.81907349, \"Lat\": 36.56176546}, {\"Country/Region\": \"Colombia\", \"Confirmed/100k\": 0.20544350771828093, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.002014152036453735, \"Confirmed\": 128.0, \"Deaths\": 0.0, \"Recovered\": 1.0, \"Long\": -73.08114582, \"Lat\": 3.91383431}, {\"Country/Region\": \"Croatia\", \"Confirmed/100k\": 2.567613830879836, \"Deaths/100k\": 0.02445346505599844, \"Recovered/100k\": 0.12226732527999218, \"Confirmed\": 128.0, \"Deaths\": 1.0, \"Recovered\": 5.0, \"Long\": 16.40412899, \"Lat\": 45.08047631}, {\"Country/Region\": \"Czechia\", \"Confirmed/100k\": 6.531337479571924, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.028233447318034257, \"Confirmed\": 833.0, \"Deaths\": 0.0, \"Recovered\": 4.0, \"Long\": 15.31240163, \"Lat\": 49.73341233}, {\"Country/Region\": \"Denmark\", \"Confirmed/100k\": 21.12999413879836, \"Deaths/100k\": 0.10349384884309402, \"Recovered/100k\": 0.01724897480718234, \"Confirmed\": 1337.0, \"Deaths\": 9.0, \"Recovered\": 1.0, \"Long\": 10.02800992, \"Lat\": 55.98125296}, {\"Country/Region\": \"Ecuador\", \"Confirmed/100k\": 1.1648082511972797, \"Deaths/100k\": 0.01755992338488361, \"Recovered/100k\": 0.0, \"Confirmed\": 367.0, \"Deaths\": 5.0, \"Recovered\": 0.0, \"Long\": -78.75201922, \"Lat\": -1.42381612}, {\"Country/Region\": \"Egypt\", \"Confirmed/100k\": 0.2601002330792733, \"Deaths/100k\": 0.0060960992127954685, \"Recovered/100k\": 0.032512529134909166, \"Confirmed\": 285.0, \"Deaths\": 8.0, \"Recovered\": 39.0, \"Long\": 29.86190099, \"Lat\": 26.49593311}, {\"Country/Region\": \"Estonia\", \"Confirmed/100k\": 20.213735649761826, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.07570687509274092, \"Confirmed\": 283.0, \"Deaths\": 0.0, \"Recovered\": 1.0, \"Long\": 25.54248537, \"Lat\": 58.67192972}, {\"Country/Region\": \"Finland\", \"Confirmed/100k\": 7.248937577586285, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.18122343943965716, \"Confirmed\": 450.0, \"Deaths\": 0.0, \"Recovered\": 10.0, \"Long\": 26.2746656, \"Lat\": 64.49884603}, {\"Country/Region\": \"France\", \"Confirmed/100k\": 16.341917276071243, \"Deaths/100k\": 0.3627556315050071, \"Recovered/100k\": 0.017913858345926282, \"Confirmed\": 12726.0, \"Deaths\": 450.0, \"Recovered\": 12.0, \"Long\": -2.76172945, \"Lat\": 42.17344011}, {\"Country/Region\": \"Germany\", \"Confirmed/100k\": 18.473874215731584, \"Deaths/100k\": 0.05305812437938575, \"Recovered/100k\": 0.13626291033796795, \"Confirmed\": 19848.0, \"Deaths\": 67.0, \"Recovered\": 180.0, \"Long\": 10.38578051, \"Lat\": 51.10698181}, {\"Country/Region\": \"Greece\", \"Confirmed/100k\": 3.896466594603785, \"Deaths/100k\": 0.055930142506274434, \"Recovered/100k\": 0.07457352334169924, \"Confirmed\": 495.0, \"Deaths\": 6.0, \"Recovered\": 19.0, \"Long\": 22.95555794, \"Lat\": 39.07469623}, {\"Country/Region\": \"India\", \"Confirmed/100k\": 0.01434256356059339, \"Deaths/100k\": 0.00029572296001223485, \"Recovered/100k\": 0.0011089611000458808, \"Confirmed\": 244.0, \"Deaths\": 5.0, \"Recovered\": 20.0, \"Long\": 79.61197609999998, \"Lat\": 22.88578212}, {\"Country/Region\": \"Indonesia\", \"Confirmed/100k\": 0.11619069298725845, \"Deaths/100k\": 0.009340087860712092, \"Recovered/100k\": 0.004109638658713321, \"Confirmed\": 369.0, \"Deaths\": 32.0, \"Recovered\": 15.0, \"Long\": 117.24011366, \"Lat\": -2.21505456}, {\"Country/Region\": \"Iran\", \"Confirmed/100k\": 22.5023709885355, \"Deaths/100k\": 1.569676989693029, \"Recovered/100k\": 6.980417142638004, \"Confirmed\": 19644.0, \"Deaths\": 1433.0, \"Recovered\": 6745.0, \"Long\": 54.27407004, \"Lat\": 32.57503292}, {\"Country/Region\": \"Iraq\", \"Confirmed/100k\": 0.4995628824778319, \"Deaths/100k\": 0.033824570167769866, \"Recovered/100k\": 0.1118812705549311, \"Confirmed\": 208.0, \"Deaths\": 17.0, \"Recovered\": 49.0, \"Long\": 43.74353149, \"Lat\": 33.03970582}, {\"Country/Region\": \"Ireland\", \"Confirmed/100k\": 11.47624006233844, \"Deaths/100k\": 0.06181098776842967, \"Recovered/100k\": 0.10301831294738276, \"Confirmed\": 683.0, \"Deaths\": 3.0, \"Recovered\": 5.0, \"Long\": -8.13793569, \"Lat\": 53.17544870000001}, {\"Country/Region\": \"Israel\", \"Confirmed/100k\": 7.620612800828473, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.12382088745806975, \"Confirmed\": 705.0, \"Deaths\": 0.0, \"Recovered\": 14.0, \"Long\": 35.00444693, \"Lat\": 31.46110101}, {\"Country/Region\": \"Italy\", \"Confirmed/100k\": 67.90357239312625, \"Deaths/100k\": 5.634498939895088, \"Recovered/100k\": 7.347188044973329, \"Confirmed\": 47021.0, \"Deaths\": 4032.0, \"Recovered\": 4440.0, \"Long\": 12.07001339, \"Lat\": 42.79662641}, {\"Country/Region\": \"Japan\", \"Confirmed/100k\": 0.7302667923821476, \"Deaths/100k\": 0.02291962876524057, \"Recovered/100k\": 0.11854980395814085, \"Confirmed\": 963.0, \"Deaths\": 33.0, \"Recovered\": 191.0, \"Long\": 138.03089558, \"Lat\": 37.59230135}, {\"Country/Region\": \"Korea, South\", \"Confirmed/100k\": 16.58750370095967, \"Deaths/100k\": 0.1762361747562557, \"Recovered/100k\": 2.9824583420289423, \"Confirmed\": 8652.0, \"Deaths\": 94.0, \"Recovered\": 1540.0, \"Long\": 127.83916086, \"Lat\": 36.38523983}, {\"Country/Region\": \"Kuwait\", \"Confirmed/100k\": 3.577204409919588, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.4350654012064364, \"Confirmed\": 159.0, \"Deaths\": 0.0, \"Recovered\": 18.0, \"Long\": 47.58700459, \"Lat\": 29.33431262}, {\"Country/Region\": \"Latvia\", \"Confirmed/100k\": 4.4639566643239545, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.05190647284097621, \"Confirmed\": 111.0, \"Deaths\": 0.0, \"Recovered\": 1.0, \"Long\": 24.91235983, \"Lat\": 56.85085163}, {\"Country/Region\": \"Lebanon\", \"Confirmed/100k\": 2.2923305482247214, \"Deaths/100k\": 0.05840332606941965, \"Recovered/100k\": 0.05840332606941965, \"Confirmed\": 163.0, \"Deaths\": 4.0, \"Recovered\": 4.0, \"Long\": 35.88016072, \"Lat\": 33.92306631}, {\"Country/Region\": \"Luxembourg\", \"Confirmed/100k\": 55.123344654187406, \"Deaths/100k\": 0.658189189900745, \"Recovered/100k\": 0.0, \"Confirmed\": 484.0, \"Deaths\": 4.0, \"Recovered\": 0.0, \"Long\": 6.07182201, \"Lat\": 49.76725361}, {\"Country/Region\": \"Malaysia\", \"Confirmed/100k\": 2.8545524640576163, \"Deaths/100k\": 0.0063434499201280355, \"Recovered/100k\": 0.23787937200480136, \"Confirmed\": 1030.0, \"Deaths\": 3.0, \"Recovered\": 87.0, \"Long\": 109.69762284, \"Lat\": 3.78986846}, {\"Country/Region\": \"Mexico\", \"Confirmed/100k\": 0.09350920290631674, \"Deaths/100k\": 0.0007924508720874299, \"Recovered/100k\": 0.0031698034883497197, \"Confirmed\": 164.0, \"Deaths\": 1.0, \"Recovered\": 4.0, \"Long\": -102.52345169, \"Lat\": 23.94753724}, {\"Country/Region\": \"Netherlands\", \"Confirmed/100k\": 14.317204840550039, \"Deaths/100k\": 0.4468685742692959, \"Recovered/100k\": 0.011606975955046644, \"Confirmed\": 3003.0, \"Deaths\": 107.0, \"Recovered\": 2.0, \"Long\": 5.28144793, \"Lat\": 52.1007899}, {\"Country/Region\": \"Norway\", \"Confirmed/100k\": 32.85452782812378, \"Deaths/100k\": 0.131719183732455, \"Recovered/100k\": 0.018817026247493568, \"Confirmed\": 1914.0, \"Deaths\": 7.0, \"Recovered\": 1.0, \"Long\": 15.34834656, \"Lat\": 68.75015572}, {\"Country/Region\": \"Pakistan\", \"Confirmed/100k\": 0.213933951803508, \"Deaths/100k\": 0.0009424403163150133, \"Recovered/100k\": 0.006125862056047585, \"Confirmed\": 501.0, \"Deaths\": 3.0, \"Recovered\": 13.0, \"Long\": 69.33957937, \"Lat\": 29.9497515}, {\"Country/Region\": \"Panama\", \"Confirmed/100k\": 2.609607713713105, \"Deaths/100k\": 0.02394135517167987, \"Recovered/100k\": 0.0, \"Confirmed\": 137.0, \"Deaths\": 1.0, \"Recovered\": 0.0, \"Long\": -80.11915156, \"Lat\": 8.51750797}, {\"Country/Region\": \"Peru\", \"Confirmed/100k\": 0.7314955996475817, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.0031260495711435115, \"Confirmed\": 234.0, \"Deaths\": 3.0, \"Recovered\": 1.0, \"Long\": -74.38242685, \"Lat\": -9.15280381}, {\"Country/Region\": \"Philippines\", \"Confirmed/100k\": 0.2034656253077183, \"Deaths/100k\": 0.01593970336512079, \"Recovered/100k\": 0.007501036877703902, \"Confirmed\": 230.0, \"Deaths\": 18.0, \"Recovered\": 8.0, \"Long\": 122.88393253, \"Lat\": 11.77536778}, {\"Country/Region\": \"Poland\", \"Confirmed/100k\": 0.9347382106340664, \"Deaths/100k\": 0.013165326910338962, \"Recovered/100k\": 0.002633065382067793, \"Confirmed\": 425.0, \"Deaths\": 5.0, \"Recovered\": 1.0, \"Long\": 19.39012835, \"Lat\": 52.12759564}, {\"Country/Region\": \"Portugal\", \"Confirmed/100k\": 7.634878146372187, \"Deaths/100k\": 0.029177878266390532, \"Recovered/100k\": 0.029177878266390532, \"Confirmed\": 1020.0, \"Deaths\": 6.0, \"Recovered\": 5.0, \"Long\": -8.50104361, \"Lat\": 39.59550671}, {\"Country/Region\": \"Qatar\", \"Confirmed/100k\": 16.536786981378498, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.14379814766416085, \"Confirmed\": 470.0, \"Deaths\": 0.0, \"Recovered\": 10.0, \"Long\": 51.18479632, \"Lat\": 25.30601188}, {\"Country/Region\": \"Romania\", \"Confirmed/100k\": 1.4224140410033186, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.12837671850210455, \"Confirmed\": 308.0, \"Deaths\": 0.0, \"Recovered\": 25.0, \"Long\": 24.97293039, \"Lat\": 45.85243127}, {\"Country/Region\": \"Russia\", \"Confirmed/100k\": 0.13773718568322316, \"Deaths/100k\": 0.0006921466617247395, \"Recovered/100k\": 0.006229319955522656, \"Confirmed\": 253.0, \"Deaths\": 1.0, \"Recovered\": 9.0, \"Long\": 96.68656112, \"Lat\": 61.98052209}, {\"Country/Region\": \"Saudi Arabia\", \"Confirmed/100k\": 0.8130576585179794, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.01780418230331341, \"Confirmed\": 344.0, \"Deaths\": 0.0, \"Recovered\": 8.0, \"Long\": 44.53686271, \"Lat\": 24.12245841}, {\"Country/Region\": \"Serbia\", \"Confirmed/100k\": 1.4752042513381391, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.014322371372214943, \"Confirmed\": 135.0, \"Deaths\": 1.0, \"Recovered\": 1.0, \"Long\": 20.78958334, \"Lat\": 44.2215032}, {\"Country/Region\": \"Singapore\", \"Confirmed/100k\": 6.118457595364586, \"Deaths/100k\": 0.0, \"Recovered/100k\": 2.0217512054248195, \"Confirmed\": 385.0, \"Deaths\": 0.0, \"Recovered\": 124.0, \"Long\": 103.81725592, \"Lat\": 1.35876087}, {\"Country/Region\": \"Slovakia\", \"Confirmed/100k\": 2.258119177655415, \"Deaths/100k\": 0.018358692501263537, \"Recovered/100k\": 0.0, \"Confirmed\": 137.0, \"Deaths\": 1.0, \"Recovered\": 0.0, \"Long\": 19.47905218, \"Lat\": 48.70547528}, {\"Country/Region\": \"Slovenia\", \"Confirmed/100k\": 13.833988271099733, \"Deaths/100k\": 0.04837058836048858, \"Recovered/100k\": 0.0, \"Confirmed\": 341.0, \"Deaths\": 1.0, \"Recovered\": 0.0, \"Long\": 14.80444238, \"Lat\": 46.11554772}, {\"Country/Region\": \"South Africa\", \"Confirmed/100k\": 0.25960709815650923, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.0, \"Confirmed\": 202.0, \"Deaths\": 0.0, \"Recovered\": 0.0, \"Long\": 25.08390093, \"Lat\": -29.00034095}, {\"Country/Region\": \"Spain\", \"Confirmed/100k\": 38.445117064557465, \"Deaths/100k\": 1.7763985505529534, \"Recovered/100k\": 2.3692448138097824, \"Confirmed\": 20410.0, \"Deaths\": 1043.0, \"Recovered\": 1588.0, \"Long\": -3.64755047, \"Lat\": 40.24448698}, {\"Country/Region\": \"Sweden\", \"Confirmed/100k\": 14.131152612029155, \"Deaths/100k\": 0.10802131948041746, \"Recovered/100k\": 0.15712191924424354, \"Confirmed\": 1639.0, \"Deaths\": 16.0, \"Recovered\": 16.0, \"Long\": 16.74558049, \"Lat\": 62.77966519}, {\"Country/Region\": \"Switzerland\", \"Confirmed/100k\": 47.84805290127696, \"Deaths/100k\": 0.4814159923809461, \"Recovered/100k\": 0.17612780209059006, \"Confirmed\": 5294.0, \"Deaths\": 54.0, \"Recovered\": 15.0, \"Long\": 8.20867471, \"Lat\": 46.79785878}, {\"Country/Region\": \"Taiwan*\", \"Confirmed/100k\": 0.4700895307274674, \"Deaths/100k\": 0.004352680840069143, \"Recovered/100k\": 0.11316970184179773, \"Confirmed\": 135.0, \"Deaths\": 2.0, \"Recovered\": 26.0, \"Long\": 120.95427281, \"Lat\": 23.7539928}, {\"Country/Region\": \"Thailand\", \"Confirmed/100k\": 0.3917698149538653, \"Deaths/100k\": 0.0014403302020362695, \"Recovered/100k\": 0.06049386848552332, \"Confirmed\": 322.0, \"Deaths\": 1.0, \"Recovered\": 42.0, \"Long\": 101.0028813, \"Lat\": 15.11815794}, {\"Country/Region\": \"Turkey\", \"Confirmed/100k\": 0.2332369335932176, \"Deaths/100k\": 0.003644327087394025, \"Recovered/100k\": 0.0, \"Confirmed\": 359.0, \"Deaths\": 4.0, \"Recovered\": 0.0, \"Long\": 35.16895346, \"Lat\": 39.0616029}, {\"Country/Region\": \"US\", \"Confirmed/100k\": 4.1804283002078995, \"Deaths/100k\": 0.06113077868257511, \"Recovered/100k\": 0.0, \"Confirmed\": 19100.0, \"Deaths\": 244.0, \"Recovered\": 0.0, \"Long\": -112.4616737, \"Lat\": 45.6795472}, {\"Country/Region\": \"United Arab Emirates\", \"Confirmed/100k\": 1.4536454780879038, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.3218786415766073, \"Confirmed\": 140.0, \"Deaths\": 2.0, \"Recovered\": 31.0, \"Long\": 54.3001671, \"Lat\": 23.90528188}, {\"Country/Region\": \"United Kingdom\", \"Confirmed/100k\": 4.084886774714328, \"Deaths/100k\": 0.20755315718357045, \"Recovered/100k\": 0.10076856182100884, \"Confirmed\": 4014.0, \"Deaths\": 178.0, \"Recovered\": 67.0, \"Long\": -2.86563164, \"Lat\": 54.12387156}]}}, {\"mode\": \"vega-lite\"});\n",
Chandrasekhar Ramakrishnan
committed
"</script>"
],
"text/plain": [
"alt.LayerChart(...)"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"\n",
"<p style=\"font-size: smaller\">Data Sources: \n",
" <a href=\"https://github.com/CSSEGISandData/COVID-19\">JHU CSSE</a>,\n",
" <a href=\"https://data.worldbank.org/indicator/SP.POP.TOTL\">World Bank</a>,\n",
" <a href=\"https://worldmap.harvard.edu/data/geonode:country_centroids_az8\">Harvard Worldmap</a>\n",
"</p>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
Chandrasekhar Ramakrishnan
committed
}
],
"source": [
"bars = alt.Chart(map_df).mark_bar().encode(\n",
Chandrasekhar Ramakrishnan
committed
" x='Confirmed/100k:Q',\n",
" y=alt.Y(\"Country/Region:N\", sort='-x'),\n",
" tooltip=[\"Country/Region:N\", \n",
" \"Confirmed:Q\", \"Deaths:Q\", \"Recovered:Q\",\n",
" \"Confirmed/100k:Q\", \"Deaths/100k:Q\", \"Recovered/100k:Q\"]\n",
Chandrasekhar Ramakrishnan
committed
")\n",
"\n",
"text = bars.mark_text(\n",
" align='left',\n",
" baseline='middle',\n",
" dx=3 # Nudges text to right so it doesn't appear on top of the bar\n",
").encode(\n",
Chandrasekhar Ramakrishnan
committed
" text=alt.Text('Confirmed/100k:Q', format=\".3\")\n",
Chandrasekhar Ramakrishnan
committed
")\n",
"\n",
"chart = (bars + text).properties(height=900, title=f\"Confirmed cases per 100k inhabitants\")\n",
"display(chart)\n",
"display(HTML('''\n",
"<p style=\"font-size: smaller\">Data Sources: \n",
" <a href=\"https://github.com/CSSEGISandData/COVID-19\">JHU CSSE</a>,\n",
" <a href=\"https://data.worldbank.org/indicator/SP.POP.TOTL\">World Bank</a>,\n",
" <a href=\"https://worldmap.harvard.edu/data/geonode:country_centroids_az8\">Harvard Worldmap</a>\n",
"</p>'''))"
]
},
{
"cell_type": "markdown",
"metadata": {
"papermill": {
"duration": 0.016329,
"end_time": "2020-03-21T08:21:35.766114",
Loading
Loading full blame...