Newer
Older
Chandrasekhar Ramakrishnan
committed
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"papermill": {
"duration": 0.293932,
"end_time": "2020-03-15T16:43:45.973942",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-15T16:43:45.680010",
Chandrasekhar Ramakrishnan
committed
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"import pandas as pd\n",
"import os\n",
"from IPython.display import display, HTML, Markdown"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"papermill": {
"duration": 0.021561,
"end_time": "2020-03-15T16:43:46.016060",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-15T16:43:45.994499",
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.021241,
"end_time": "2020-03-15T16:43:46.046986",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-15T16:43:46.025745",
Chandrasekhar Ramakrishnan
committed
"status": "completed"
},
"tags": [
"injected-parameters"
]
},
"outputs": [],
"source": [
"# Parameters\n",
"PAPERMILL_INPUT_PATH = \"/tmp/e5179t23/notebooks/Dashboard.ipynb\"\n",
Chandrasekhar Ramakrishnan
committed
"PAPERMILL_OUTPUT_PATH = \"runs/Dashboard.run.ipynb\"\n",
"ts_folder = \"/tmp/e5179t23/data/covid-19_jhu-csse\"\n",
"rates_folder = \"/tmp/e5179t23/data/covid-19_rates\"\n",
"geodata_path = \"/tmp/e5179t23/data/geodata/geo_data.csv\"\n"
Chandrasekhar Ramakrishnan
committed
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"papermill": {
"duration": 0.018914,
"end_time": "2020-03-15T16:43:46.075312",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-15T16:43:46.056398",
Chandrasekhar Ramakrishnan
committed
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"# Read in the data"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"papermill": {
"duration": 0.083927,
"end_time": "2020-03-15T16:43:46.168567",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-15T16:43:46.084640",
Chandrasekhar Ramakrishnan
committed
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"def read_jhu_covid_df(name):\n",
" filename = os.path.join(ts_folder, f\"time_series_19-covid-{name}.csv\")\n",
" df = pd.read_csv(filename)\n",
" df = df.set_index(['Province/State', 'Country/Region', 'Lat', 'Long'])\n",
" df.columns = pd.to_datetime(df.columns)\n",
" return df\n",
"\n",
"\n",
"jhu_frames_map = {\n",
" \"confirmed\": read_jhu_covid_df(\"Confirmed\"),\n",
" \"deaths\": read_jhu_covid_df(\"Deaths\"),\n",
" \"recovered\": read_jhu_covid_df(\"Recovered\")\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"papermill": {
"duration": 0.05099,
"end_time": "2020-03-15T16:43:46.238223",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-15T16:43:46.187233",
Chandrasekhar Ramakrishnan
committed
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"def read_rates_covid_df(name):\n",
" filename = os.path.join(rates_folder, f\"ts_rates_19-covid-{name}.csv\")\n",
" df = pd.read_csv(filename).drop(\"Unnamed: 0\", axis=1)\n",
" df = df.set_index(['Country/Region'])\n",
" df.columns = pd.to_datetime(df.columns)\n",
" return df\n",
"\n",
"\n",
"rates_frames_map = {\n",
" \"confirmed\": read_rates_covid_df(\"confirmed\"),\n",
" \"deaths\": read_rates_covid_df(\"deaths\"),\n",
" \"recovered\": read_rates_covid_df(\"recovered\")\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"papermill": {
"duration": 0.035159,
"end_time": "2020-03-15T16:43:46.292298",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-15T16:43:46.257139",
Chandrasekhar Ramakrishnan
committed
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
Chandrasekhar Ramakrishnan
committed
"geodata_df = pd.read_csv(geodata_path)\n",
"geodata_df = geodata_df.drop('Unnamed: 0', axis=1)\n",
"geodata_df = geodata_df.rename({'name_jhu':'Country/Region'}, axis=1)\n",
"geodata_df = geodata_df.set_index('Country/Region')"
Chandrasekhar Ramakrishnan
committed
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"papermill": {
"duration": 0.03375,
"end_time": "2020-03-15T16:43:46.338662",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-15T16:43:46.304912",
Chandrasekhar Ramakrishnan
committed
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"# Identify countries with 100 or more cases\n",
Chandrasekhar Ramakrishnan
committed
"def latest_jhu_country_ser(name):\n",
" return jhu_frames_map[name].iloc[:,-1].groupby(level='Country/Region').sum()\n",
"\n",
"\n",
"case_count_ser = latest_jhu_country_ser('confirmed')\n",
Chandrasekhar Ramakrishnan
committed
"countries_over_thresh = case_count_ser[case_count_ser > 99].index"
]
},
{
"cell_type": "markdown",
"metadata": {
"papermill": {
"duration": 0.008732,
"end_time": "2020-03-15T16:43:46.360234",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-15T16:43:46.351502",
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
"execution_count": 9,
Chandrasekhar Ramakrishnan
committed
"metadata": {
"papermill": {
"duration": 0.039299,
"end_time": "2020-03-15T16:43:46.406504",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-15T16:43:46.367205",
Chandrasekhar Ramakrishnan
committed
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/html": [
"<em>Data up to Mar 14 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.009517,
"end_time": "2020-03-15T16:43:46.431623",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-15T16:43:46.422106",
Chandrasekhar Ramakrishnan
committed
"status": "completed"
},
"tags": []
},
"source": [
"## How are cases per 100,000 distributed geographically?"
]
},
{
"cell_type": "code",
Chandrasekhar Ramakrishnan
committed
"execution_count": 10,
Chandrasekhar Ramakrishnan
committed
"metadata": {
"papermill": {
"duration": 0.19163,
"end_time": "2020-03-15T16:43:46.630939",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-15T16:43:46.439309",
Chandrasekhar Ramakrishnan
committed
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"import altair as alt\n",
"from vega_datasets import data"
]
},
{
"cell_type": "code",
Chandrasekhar Ramakrishnan
committed
"execution_count": 11,
Chandrasekhar Ramakrishnan
committed
"metadata": {
"papermill": {
"duration": 0.048909,
"end_time": "2020-03-15T16:43:46.699290",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-15T16:43:46.650381",
Chandrasekhar Ramakrishnan
committed
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
Chandrasekhar Ramakrishnan
committed
"def latest_rates_ser(name):\n",
" return rates_frames_map[name].iloc[:,-1]\n",
"\n",
"\n",
Chandrasekhar Ramakrishnan
committed
"# Compile the basic df\n",
"map_df = pd.concat([\n",
Chandrasekhar Ramakrishnan
committed
" latest_rates_ser('confirmed'),\n",
" latest_rates_ser('deaths'),\n",
" latest_rates_ser('recovered')], axis=1)\n",
"nominal_df = pd.concat([\n",
" latest_jhu_country_ser('confirmed'),\n",
" latest_jhu_country_ser('deaths'),\n",
" latest_jhu_country_ser('recovered')], axis=1)\n",
"map_df = pd.concat([map_df, nominal_df, geodata_df[['Longitude', 'Latitude']]], axis=1)\n",
Chandrasekhar Ramakrishnan
committed
"# Restrict to countries with 100 or more cases\n",
"map_df = map_df.loc[countries_over_thresh].dropna()\n",
"map_df = map_df.reset_index()\n",
Chandrasekhar Ramakrishnan
committed
"map_df.columns = ['Country/Region', \n",
" 'Confirmed/100k', 'Deaths/100k', 'Recovered/100k', \n",
" 'Confirmed', 'Deaths', 'Recovered',\n",
" 'Long', 'Lat']"
Chandrasekhar Ramakrishnan
committed
]
},
{
"cell_type": "code",
Chandrasekhar Ramakrishnan
committed
"execution_count": 12,
Chandrasekhar Ramakrishnan
committed
"metadata": {
"papermill": {
"duration": 0.032927,
"end_time": "2020-03-15T16:43:46.747943",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-15T16:43:46.715016",
Chandrasekhar Ramakrishnan
committed
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
Chandrasekhar Ramakrishnan
committed
"def map_of_variable(map_df, variable, title):\n",
Chandrasekhar Ramakrishnan
committed
" # Data generators for the background\n",
" sphere = alt.sphere()\n",
" graticule = alt.graticule()\n",
"\n",
" # Source of land data\n",
" source = alt.topo_feature(data.world_110m.url, 'countries')\n",
"\n",
" # Layering and configuring the components\n",
" p = alt.layer(\n",
" alt.Chart(sphere).mark_geoshape(fill='#cae6ef'),\n",
" alt.Chart(graticule).mark_geoshape(stroke='white', strokeWidth=0.5),\n",
" alt.Chart(source).mark_geoshape(fill='#dddddd', stroke='#aaaaaa'),\n",
" alt.Chart(map_df).mark_circle(opacity=0.6).encode(\n",
" longitude='Long:Q',\n",
" latitude='Lat:Q',\n",
" size=alt.Size(f'{variable}:Q', title=\"Cases\"),\n",
" color=alt.value('steelblue'),\n",
Chandrasekhar Ramakrishnan
committed
" 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",
" ).project(\n",
" 'naturalEarth1'\n",
Chandrasekhar Ramakrishnan
committed
" ).properties(width=600, height=400, title=f\"{title} cases per 100k inhabitants\"\n",
Chandrasekhar Ramakrishnan
committed
" ).configure_view(stroke=None)\n",
" return p"
]
},
{
"cell_type": "code",
Chandrasekhar Ramakrishnan
committed
"execution_count": 13,
Chandrasekhar Ramakrishnan
committed
"metadata": {
"papermill": {
"duration": 0.118918,
"end_time": "2020-03-15T16:43:46.881935",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-15T16:43:46.763017",
Chandrasekhar Ramakrishnan
committed
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"<div id=\"altair-viz-88d3169c31ab4a01b36f275f24a4faa8\"></div>\n",
Chandrasekhar Ramakrishnan
committed
"<script type=\"text/javascript\">\n",
" (function(spec, embedOpt){\n",
" const outputDiv = document.getElementById(\"altair-viz-88d3169c31ab4a01b36f275f24a4faa8\");\n",
Chandrasekhar Ramakrishnan
committed
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
" 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-f3b3d5ed8d303f261562171c1d731858\"}, \"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-f3b3d5ed8d303f261562171c1d731858\": [{\"Country/Region\": \"Australia\", \"Confirmed/100k\": 1.000305333199906, \"Deaths/100k\": 0.012003663998398872, \"Recovered/100k\": 0.09202809065439137, \"Confirmed\": 250.0, \"Deaths\": 3.0, \"Recovered\": 23.0, \"Long\": 134.49100008, \"Lat\": -25.73288704}, {\"Country/Region\": \"Austria\", \"Confirmed/100k\": 7.403608688423027, \"Deaths/100k\": 0.01130321937163821, \"Recovered/100k\": 0.06781931622982926, \"Confirmed\": 655.0, \"Deaths\": 1.0, \"Recovered\": 6.0, \"Long\": 14.1264761, \"Lat\": 47.58549439}, {\"Country/Region\": \"Bahrain\", \"Confirmed/100k\": 13.380577391029535, \"Deaths/100k\": 0.0, \"Recovered/100k\": 2.8035495485966644, \"Confirmed\": 210.0, \"Deaths\": 0.0, \"Recovered\": 44.0, \"Long\": 50.54196932, \"Lat\": 26.04205135}, {\"Country/Region\": \"Belgium\", \"Confirmed/100k\": 6.0321826135162215, \"Deaths/100k\": 0.035019928090079665, \"Recovered/100k\": 0.008754982022519914, \"Confirmed\": 689.0, \"Deaths\": 4.0, \"Recovered\": 1.0, \"Long\": 4.64065114, \"Lat\": 50.63981576}, {\"Country/Region\": \"Brazil\", \"Confirmed/100k\": 0.07208692453324421, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.0, \"Confirmed\": 151.0, \"Deaths\": 0.0, \"Recovered\": 0.0, \"Long\": -53.09783113, \"Lat\": -10.78777702}, {\"Country/Region\": \"Canada\", \"Confirmed/100k\": 0.53428524615007, \"Deaths/100k\": 0.002698410334091263, \"Recovered/100k\": 0.021587282672730104, \"Confirmed\": 198.0, \"Deaths\": 1.0, \"Recovered\": 8.0, \"Long\": -98.30777028, \"Lat\": 61.36206324}, {\"Country/Region\": \"China\", \"Confirmed/100k\": 5.814264071284455, \"Deaths/100k\": 0.2292619531423894, \"Recovered/100k\": 4.7144816296051655, \"Confirmed\": 80977.0, \"Deaths\": 3193.0, \"Recovered\": 65660.0, \"Long\": 103.81907349, \"Lat\": 36.56176546}, {\"Country/Region\": \"Czechia\", \"Confirmed/100k\": 1.7787071810361583, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.0, \"Confirmed\": 189.0, \"Deaths\": 0.0, \"Recovered\": 0.0, \"Long\": 15.31240163, \"Lat\": 49.73341233}, {\"Country/Region\": \"Denmark\", \"Confirmed/100k\": 14.420142938804432, \"Deaths/100k\": 0.01724897480718234, \"Recovered/100k\": 0.01724897480718234, \"Confirmed\": 836.0, \"Deaths\": 1.0, \"Recovered\": 1.0, \"Long\": 10.02800992, \"Lat\": 55.98125296}, {\"Country/Region\": \"Egypt\", \"Confirmed/100k\": 0.11074580236578434, \"Deaths/100k\": 0.002032033070931823, \"Recovered/100k\": 0.02743244645757961, \"Confirmed\": 109.0, \"Deaths\": 2.0, \"Recovered\": 27.0, \"Long\": 29.86190099, \"Lat\": 26.49593311}, {\"Country/Region\": \"Estonia\", \"Confirmed/100k\": 8.706290635665205, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.0, \"Confirmed\": 115.0, \"Deaths\": 0.0, \"Recovered\": 0.0, \"Long\": 25.54248537, \"Lat\": 58.67192972}, {\"Country/Region\": \"Finland\", \"Confirmed/100k\": 4.077527387392285, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.018122343943965717, \"Confirmed\": 225.0, \"Deaths\": 0.0, \"Recovered\": 1.0, \"Long\": 26.2746656, \"Lat\": 64.49884603}, {\"Country/Region\": \"France\", \"Confirmed/100k\": 6.687840449145809, \"Deaths/100k\": 0.13584675912327426, \"Recovered/100k\": 0.017913858345926282, \"Confirmed\": 4480.0, \"Deaths\": 91.0, \"Recovered\": 12.0, \"Long\": -2.76172945, \"Lat\": 42.17344011}, {\"Country/Region\": \"Germany\", \"Confirmed/100k\": 5.528897733624627, \"Deaths/100k\": 0.010852798168510723, \"Recovered/100k\": 0.055469857305721466, \"Confirmed\": 4585.0, \"Deaths\": 9.0, \"Recovered\": 46.0, \"Long\": 10.38578051, \"Lat\": 51.10698181}, {\"Country/Region\": \"Greece\", \"Confirmed/100k\": 2.1253454152384283, \"Deaths/100k\": 0.027965071253137214, \"Recovered/100k\": 0.07457352334169924, \"Confirmed\": 228.0, \"Deaths\": 3.0, \"Recovered\": 8.0, \"Long\": 22.95555794, \"Lat\": 39.07469623}, {\"Country/Region\": \"Iceland\", \"Confirmed/100k\": 44.1208912420031, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.28282622591027623, \"Confirmed\": 156.0, \"Deaths\": 0.0, \"Recovered\": 1.0, \"Long\": -18.57396167, \"Lat\": 64.99575386}, {\"Country/Region\": \"India\", \"Confirmed/100k\": 0.007540935480311991, \"Deaths/100k\": 0.00014786148000611743, \"Recovered/100k\": 0.00029572296001223485, \"Confirmed\": 102.0, \"Deaths\": 2.0, \"Recovered\": 4.0, \"Long\": 79.61197609999998, \"Lat\": 22.88578212}, {\"Country/Region\": \"Iran\", \"Confirmed/100k\": 15.561073521653087, \"Deaths/100k\": 0.7469413089582871, \"Recovered/100k\": 3.6173475175246668, \"Confirmed\": 12729.0, \"Deaths\": 611.0, \"Recovered\": 2959.0, \"Long\": 54.27407004, \"Lat\": 32.57503292}, {\"Country/Region\": \"Iraq\", \"Confirmed/100k\": 0.2862079014195912, \"Deaths/100k\": 0.026018900129053748, \"Recovered/100k\": 0.06764914033553975, \"Confirmed\": 110.0, \"Deaths\": 10.0, \"Recovered\": 26.0, \"Long\": 43.74353149, \"Lat\": 33.03970582}, {\"Country/Region\": \"Ireland\", \"Confirmed/100k\": 2.657872474042476, \"Deaths/100k\": 0.04120732517895311, \"Recovered/100k\": 0.0, \"Confirmed\": 129.0, \"Deaths\": 2.0, \"Recovered\": 0.0, \"Long\": -8.13793569, \"Lat\": 53.17544870000001}, {\"Country/Region\": \"Israel\", \"Confirmed/100k\": 2.1724937526734056, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.045025777257479915, \"Confirmed\": 193.0, \"Deaths\": 0.0, \"Recovered\": 4.0, \"Long\": 35.00444693, \"Lat\": 31.46110101}, {\"Country/Region\": \"Italy\", \"Confirmed/100k\": 35.0100129431308, \"Deaths/100k\": 2.3845265704519294, \"Recovered/100k\": 3.25328191360756, \"Confirmed\": 21157.0, \"Deaths\": 1441.0, \"Recovered\": 1966.0, \"Long\": 12.07001339, \"Lat\": 42.79662641}, {\"Country/Region\": \"Japan\", \"Confirmed/100k\": 0.6109266563976192, \"Deaths/100k\": 0.017387304580527327, \"Recovered/100k\": 0.09325917911373748, \"Confirmed\": 773.0, \"Deaths\": 22.0, \"Recovered\": 118.0, \"Long\": 138.03089558, \"Lat\": 37.59230135}, {\"Country/Region\": \"Korea, South\", \"Confirmed/100k\": 15.659842956913007, \"Deaths/100k\": 0.13943961079615835, \"Recovered/100k\": 0.9876972431394551, \"Confirmed\": 8086.0, \"Deaths\": 72.0, \"Recovered\": 510.0, \"Long\": 127.83916086, \"Lat\": 36.38523983}, {\"Country/Region\": \"Kuwait\", \"Confirmed/100k\": 2.513711206970521, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.1208515003351212, \"Confirmed\": 104.0, \"Deaths\": 0.0, \"Recovered\": 5.0, \"Long\": 47.58700459, \"Lat\": 29.33431262}, {\"Country/Region\": \"Malaysia\", \"Confirmed/100k\": 0.7548705404952363, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.11101037360224064, \"Confirmed\": 238.0, \"Deaths\": 0.0, \"Recovered\": 35.0, \"Long\": 109.69762284, \"Lat\": 3.78986846}, {\"Country/Region\": \"Netherlands\", \"Confirmed/100k\": 5.565544970444868, \"Deaths/100k\": 0.06964185573027988, \"Recovered/100k\": 0.011606975955046644, \"Confirmed\": 959.0, \"Deaths\": 12.0, \"Recovered\": 2.0, \"Long\": 5.28144793, \"Lat\": 52.1007899}, {\"Country/Region\": \"Norway\", \"Confirmed/100k\": 20.510558609767997, \"Deaths/100k\": 0.056451078742480724, \"Recovered/100k\": 0.018817026247493568, \"Confirmed\": 1090.0, \"Deaths\": 3.0, \"Recovered\": 1.0, \"Long\": 15.34834656, \"Lat\": 68.75015572}, {\"Country/Region\": \"Philippines\", \"Confirmed/100k\": 0.10407688667814162, \"Deaths/100k\": 0.007501036877703902, \"Recovered/100k\": 0.0018752592194259754, \"Confirmed\": 111.0, \"Deaths\": 8.0, \"Recovered\": 2.0, \"Long\": 122.88393253, \"Lat\": 11.77536778}, {\"Country/Region\": \"Poland\", \"Confirmed/100k\": 0.2712057343529827, \"Deaths/100k\": 0.007899196146203378, \"Recovered/100k\": 0.0, \"Confirmed\": 103.0, \"Deaths\": 3.0, \"Recovered\": 0.0, \"Long\": 19.39012835, \"Lat\": 52.12759564}, {\"Country/Region\": \"Portugal\", \"Confirmed/100k\": 1.6436871423399997, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.01945191884426035, \"Confirmed\": 169.0, \"Deaths\": 0.0, \"Recovered\": 2.0, \"Long\": -8.50104361, \"Lat\": 39.59550671}, {\"Country/Region\": \"Qatar\", \"Confirmed/100k\": 12.114993940705553, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.14379814766416085, \"Confirmed\": 337.0, \"Deaths\": 0.0, \"Recovered\": 4.0, \"Long\": 51.18479632, \"Lat\": 25.30601188}, {\"Country/Region\": \"Romania\", \"Confirmed/100k\": 0.6316134550303544, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.046215618660757636, \"Confirmed\": 123.0, \"Deaths\": 0.0, \"Recovered\": 9.0, \"Long\": 24.97293039, \"Lat\": 45.85243127}, {\"Country/Region\": \"Saudi Arabia\", \"Confirmed/100k\": 0.30563846287354696, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.0029673637172189025, \"Confirmed\": 103.0, \"Deaths\": 0.0, \"Recovered\": 1.0, \"Long\": 44.53686271, \"Lat\": 24.12245841}, {\"Country/Region\": \"Singapore\", \"Confirmed/100k\": 3.7597478557022965, \"Deaths/100k\": 0.0, \"Recovered/100k\": 1.8621392681544395, \"Confirmed\": 212.0, \"Deaths\": 0.0, \"Recovered\": 105.0, \"Long\": 103.81725592, \"Lat\": 1.35876087}, {\"Country/Region\": \"Slovenia\", \"Confirmed/100k\": 8.755076493248433, \"Deaths/100k\": 0.04837058836048858, \"Recovered/100k\": 0.0, \"Confirmed\": 181.0, \"Deaths\": 1.0, \"Recovered\": 0.0, \"Long\": 14.80444238, \"Lat\": 46.11554772}, {\"Country/Region\": \"Spain\", \"Confirmed/100k\": 13.678268839257742, \"Deaths/100k\": 0.4173466474190673, \"Recovered/100k\": 1.1065036754649118, \"Confirmed\": 6391.0, \"Deaths\": 195.0, \"Recovered\": 517.0, \"Long\": -3.64755047, \"Lat\": 40.24448698}, {\"Country/Region\": \"Sweden\", \"Confirmed/100k\": 9.437135274607376, \"Deaths/100k\": 0.019640239905530446, \"Recovered/100k\": 0.009820119952765223, \"Confirmed\": 961.0, \"Deaths\": 2.0, \"Recovered\": 1.0, \"Long\": 16.74558049, \"Lat\": 62.77966519}, {\"Country/Region\": \"Switzerland\", \"Confirmed/100k\": 15.957178869407455, \"Deaths/100k\": 0.15264409514517804, \"Recovered/100k\": 0.04696741389082401, \"Confirmed\": 1359.0, \"Deaths\": 13.0, \"Recovered\": 4.0, \"Long\": 8.20867471, \"Lat\": 46.79785878}, {\"Country/Region\": \"US\", \"Confirmed/100k\": 0.8335181673369116, \"Deaths/100k\": 0.01650531024429528, \"Recovered/100k\": 0.0036678467209545055, \"Confirmed\": 2727.0, \"Deaths\": 54.0, \"Recovered\": 12.0, \"Long\": -112.4616737, \"Lat\": 45.6795472}, {\"Country/Region\": \"United Kingdom\", \"Confirmed/100k\": 1.719081584498703, \"Deaths/100k\": 0.031584176093152026, \"Recovered/100k\": 0.028576159322375637, \"Confirmed\": 1143.0, \"Deaths\": 21.0, \"Recovered\": 19.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": [
Chandrasekhar Ramakrishnan
committed
"display(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
"execution_count": 14,
Chandrasekhar Ramakrishnan
committed
"metadata": {
"papermill": {
"duration": 0.091709,
"end_time": "2020-03-15T16:43:46.992648",
Chandrasekhar Ramakrishnan
committed
"exception": false,
"start_time": "2020-03-15T16:43:46.900939",
Chandrasekhar Ramakrishnan
committed
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"<div id=\"altair-viz-1547c49492144563b9afc56050315808\"></div>\n",
Chandrasekhar Ramakrishnan
committed
"<script type=\"text/javascript\">\n",
" (function(spec, embedOpt){\n",
" const outputDiv = document.getElementById(\"altair-viz-1547c49492144563b9afc56050315808\");\n",
Chandrasekhar Ramakrishnan
committed
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
" 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-f3b3d5ed8d303f261562171c1d731858\"}, \"height\": 900, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-f3b3d5ed8d303f261562171c1d731858\": [{\"Country/Region\": \"Australia\", \"Confirmed/100k\": 1.000305333199906, \"Deaths/100k\": 0.012003663998398872, \"Recovered/100k\": 0.09202809065439137, \"Confirmed\": 250.0, \"Deaths\": 3.0, \"Recovered\": 23.0, \"Long\": 134.49100008, \"Lat\": -25.73288704}, {\"Country/Region\": \"Austria\", \"Confirmed/100k\": 7.403608688423027, \"Deaths/100k\": 0.01130321937163821, \"Recovered/100k\": 0.06781931622982926, \"Confirmed\": 655.0, \"Deaths\": 1.0, \"Recovered\": 6.0, \"Long\": 14.1264761, \"Lat\": 47.58549439}, {\"Country/Region\": \"Bahrain\", \"Confirmed/100k\": 13.380577391029535, \"Deaths/100k\": 0.0, \"Recovered/100k\": 2.8035495485966644, \"Confirmed\": 210.0, \"Deaths\": 0.0, \"Recovered\": 44.0, \"Long\": 50.54196932, \"Lat\": 26.04205135}, {\"Country/Region\": \"Belgium\", \"Confirmed/100k\": 6.0321826135162215, \"Deaths/100k\": 0.035019928090079665, \"Recovered/100k\": 0.008754982022519914, \"Confirmed\": 689.0, \"Deaths\": 4.0, \"Recovered\": 1.0, \"Long\": 4.64065114, \"Lat\": 50.63981576}, {\"Country/Region\": \"Brazil\", \"Confirmed/100k\": 0.07208692453324421, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.0, \"Confirmed\": 151.0, \"Deaths\": 0.0, \"Recovered\": 0.0, \"Long\": -53.09783113, \"Lat\": -10.78777702}, {\"Country/Region\": \"Canada\", \"Confirmed/100k\": 0.53428524615007, \"Deaths/100k\": 0.002698410334091263, \"Recovered/100k\": 0.021587282672730104, \"Confirmed\": 198.0, \"Deaths\": 1.0, \"Recovered\": 8.0, \"Long\": -98.30777028, \"Lat\": 61.36206324}, {\"Country/Region\": \"China\", \"Confirmed/100k\": 5.814264071284455, \"Deaths/100k\": 0.2292619531423894, \"Recovered/100k\": 4.7144816296051655, \"Confirmed\": 80977.0, \"Deaths\": 3193.0, \"Recovered\": 65660.0, \"Long\": 103.81907349, \"Lat\": 36.56176546}, {\"Country/Region\": \"Czechia\", \"Confirmed/100k\": 1.7787071810361583, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.0, \"Confirmed\": 189.0, \"Deaths\": 0.0, \"Recovered\": 0.0, \"Long\": 15.31240163, \"Lat\": 49.73341233}, {\"Country/Region\": \"Denmark\", \"Confirmed/100k\": 14.420142938804432, \"Deaths/100k\": 0.01724897480718234, \"Recovered/100k\": 0.01724897480718234, \"Confirmed\": 836.0, \"Deaths\": 1.0, \"Recovered\": 1.0, \"Long\": 10.02800992, \"Lat\": 55.98125296}, {\"Country/Region\": \"Egypt\", \"Confirmed/100k\": 0.11074580236578434, \"Deaths/100k\": 0.002032033070931823, \"Recovered/100k\": 0.02743244645757961, \"Confirmed\": 109.0, \"Deaths\": 2.0, \"Recovered\": 27.0, \"Long\": 29.86190099, \"Lat\": 26.49593311}, {\"Country/Region\": \"Estonia\", \"Confirmed/100k\": 8.706290635665205, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.0, \"Confirmed\": 115.0, \"Deaths\": 0.0, \"Recovered\": 0.0, \"Long\": 25.54248537, \"Lat\": 58.67192972}, {\"Country/Region\": \"Finland\", \"Confirmed/100k\": 4.077527387392285, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.018122343943965717, \"Confirmed\": 225.0, \"Deaths\": 0.0, \"Recovered\": 1.0, \"Long\": 26.2746656, \"Lat\": 64.49884603}, {\"Country/Region\": \"France\", \"Confirmed/100k\": 6.687840449145809, \"Deaths/100k\": 0.13584675912327426, \"Recovered/100k\": 0.017913858345926282, \"Confirmed\": 4480.0, \"Deaths\": 91.0, \"Recovered\": 12.0, \"Long\": -2.76172945, \"Lat\": 42.17344011}, {\"Country/Region\": \"Germany\", \"Confirmed/100k\": 5.528897733624627, \"Deaths/100k\": 0.010852798168510723, \"Recovered/100k\": 0.055469857305721466, \"Confirmed\": 4585.0, \"Deaths\": 9.0, \"Recovered\": 46.0, \"Long\": 10.38578051, \"Lat\": 51.10698181}, {\"Country/Region\": \"Greece\", \"Confirmed/100k\": 2.1253454152384283, \"Deaths/100k\": 0.027965071253137214, \"Recovered/100k\": 0.07457352334169924, \"Confirmed\": 228.0, \"Deaths\": 3.0, \"Recovered\": 8.0, \"Long\": 22.95555794, \"Lat\": 39.07469623}, {\"Country/Region\": \"Iceland\", \"Confirmed/100k\": 44.1208912420031, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.28282622591027623, \"Confirmed\": 156.0, \"Deaths\": 0.0, \"Recovered\": 1.0, \"Long\": -18.57396167, \"Lat\": 64.99575386}, {\"Country/Region\": \"India\", \"Confirmed/100k\": 0.007540935480311991, \"Deaths/100k\": 0.00014786148000611743, \"Recovered/100k\": 0.00029572296001223485, \"Confirmed\": 102.0, \"Deaths\": 2.0, \"Recovered\": 4.0, \"Long\": 79.61197609999998, \"Lat\": 22.88578212}, {\"Country/Region\": \"Iran\", \"Confirmed/100k\": 15.561073521653087, \"Deaths/100k\": 0.7469413089582871, \"Recovered/100k\": 3.6173475175246668, \"Confirmed\": 12729.0, \"Deaths\": 611.0, \"Recovered\": 2959.0, \"Long\": 54.27407004, \"Lat\": 32.57503292}, {\"Country/Region\": \"Iraq\", \"Confirmed/100k\": 0.2862079014195912, \"Deaths/100k\": 0.026018900129053748, \"Recovered/100k\": 0.06764914033553975, \"Confirmed\": 110.0, \"Deaths\": 10.0, \"Recovered\": 26.0, \"Long\": 43.74353149, \"Lat\": 33.03970582}, {\"Country/Region\": \"Ireland\", \"Confirmed/100k\": 2.657872474042476, \"Deaths/100k\": 0.04120732517895311, \"Recovered/100k\": 0.0, \"Confirmed\": 129.0, \"Deaths\": 2.0, \"Recovered\": 0.0, \"Long\": -8.13793569, \"Lat\": 53.17544870000001}, {\"Country/Region\": \"Israel\", \"Confirmed/100k\": 2.1724937526734056, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.045025777257479915, \"Confirmed\": 193.0, \"Deaths\": 0.0, \"Recovered\": 4.0, \"Long\": 35.00444693, \"Lat\": 31.46110101}, {\"Country/Region\": \"Italy\", \"Confirmed/100k\": 35.0100129431308, \"Deaths/100k\": 2.3845265704519294, \"Recovered/100k\": 3.25328191360756, \"Confirmed\": 21157.0, \"Deaths\": 1441.0, \"Recovered\": 1966.0, \"Long\": 12.07001339, \"Lat\": 42.79662641}, {\"Country/Region\": \"Japan\", \"Confirmed/100k\": 0.6109266563976192, \"Deaths/100k\": 0.017387304580527327, \"Recovered/100k\": 0.09325917911373748, \"Confirmed\": 773.0, \"Deaths\": 22.0, \"Recovered\": 118.0, \"Long\": 138.03089558, \"Lat\": 37.59230135}, {\"Country/Region\": \"Korea, South\", \"Confirmed/100k\": 15.659842956913007, \"Deaths/100k\": 0.13943961079615835, \"Recovered/100k\": 0.9876972431394551, \"Confirmed\": 8086.0, \"Deaths\": 72.0, \"Recovered\": 510.0, \"Long\": 127.83916086, \"Lat\": 36.38523983}, {\"Country/Region\": \"Kuwait\", \"Confirmed/100k\": 2.513711206970521, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.1208515003351212, \"Confirmed\": 104.0, \"Deaths\": 0.0, \"Recovered\": 5.0, \"Long\": 47.58700459, \"Lat\": 29.33431262}, {\"Country/Region\": \"Malaysia\", \"Confirmed/100k\": 0.7548705404952363, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.11101037360224064, \"Confirmed\": 238.0, \"Deaths\": 0.0, \"Recovered\": 35.0, \"Long\": 109.69762284, \"Lat\": 3.78986846}, {\"Country/Region\": \"Netherlands\", \"Confirmed/100k\": 5.565544970444868, \"Deaths/100k\": 0.06964185573027988, \"Recovered/100k\": 0.011606975955046644, \"Confirmed\": 959.0, \"Deaths\": 12.0, \"Recovered\": 2.0, \"Long\": 5.28144793, \"Lat\": 52.1007899}, {\"Country/Region\": \"Norway\", \"Confirmed/100k\": 20.510558609767997, \"Deaths/100k\": 0.056451078742480724, \"Recovered/100k\": 0.018817026247493568, \"Confirmed\": 1090.0, \"Deaths\": 3.0, \"Recovered\": 1.0, \"Long\": 15.34834656, \"Lat\": 68.75015572}, {\"Country/Region\": \"Philippines\", \"Confirmed/100k\": 0.10407688667814162, \"Deaths/100k\": 0.007501036877703902, \"Recovered/100k\": 0.0018752592194259754, \"Confirmed\": 111.0, \"Deaths\": 8.0, \"Recovered\": 2.0, \"Long\": 122.88393253, \"Lat\": 11.77536778}, {\"Country/Region\": \"Poland\", \"Confirmed/100k\": 0.2712057343529827, \"Deaths/100k\": 0.007899196146203378, \"Recovered/100k\": 0.0, \"Confirmed\": 103.0, \"Deaths\": 3.0, \"Recovered\": 0.0, \"Long\": 19.39012835, \"Lat\": 52.12759564}, {\"Country/Region\": \"Portugal\", \"Confirmed/100k\": 1.6436871423399997, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.01945191884426035, \"Confirmed\": 169.0, \"Deaths\": 0.0, \"Recovered\": 2.0, \"Long\": -8.50104361, \"Lat\": 39.59550671}, {\"Country/Region\": \"Qatar\", \"Confirmed/100k\": 12.114993940705553, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.14379814766416085, \"Confirmed\": 337.0, \"Deaths\": 0.0, \"Recovered\": 4.0, \"Long\": 51.18479632, \"Lat\": 25.30601188}, {\"Country/Region\": \"Romania\", \"Confirmed/100k\": 0.6316134550303544, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.046215618660757636, \"Confirmed\": 123.0, \"Deaths\": 0.0, \"Recovered\": 9.0, \"Long\": 24.97293039, \"Lat\": 45.85243127}, {\"Country/Region\": \"Saudi Arabia\", \"Confirmed/100k\": 0.30563846287354696, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.0029673637172189025, \"Confirmed\": 103.0, \"Deaths\": 0.0, \"Recovered\": 1.0, \"Long\": 44.53686271, \"Lat\": 24.12245841}, {\"Country/Region\": \"Singapore\", \"Confirmed/100k\": 3.7597478557022965, \"Deaths/100k\": 0.0, \"Recovered/100k\": 1.8621392681544395, \"Confirmed\": 212.0, \"Deaths\": 0.0, \"Recovered\": 105.0, \"Long\": 103.81725592, \"Lat\": 1.35876087}, {\"Country/Region\": \"Slovenia\", \"Confirmed/100k\": 8.755076493248433, \"Deaths/100k\": 0.04837058836048858, \"Recovered/100k\": 0.0, \"Confirmed\": 181.0, \"Deaths\": 1.0, \"Recovered\": 0.0, \"Long\": 14.80444238, \"Lat\": 46.11554772}, {\"Country/Region\": \"Spain\", \"Confirmed/100k\": 13.678268839257742, \"Deaths/100k\": 0.4173466474190673, \"Recovered/100k\": 1.1065036754649118, \"Confirmed\": 6391.0, \"Deaths\": 195.0, \"Recovered\": 517.0, \"Long\": -3.64755047, \"Lat\": 40.24448698}, {\"Country/Region\": \"Sweden\", \"Confirmed/100k\": 9.437135274607376, \"Deaths/100k\": 0.019640239905530446, \"Recovered/100k\": 0.009820119952765223, \"Confirmed\": 961.0, \"Deaths\": 2.0, \"Recovered\": 1.0, \"Long\": 16.74558049, \"Lat\": 62.77966519}, {\"Country/Region\": \"Switzerland\", \"Confirmed/100k\": 15.957178869407455, \"Deaths/100k\": 0.15264409514517804, \"Recovered/100k\": 0.04696741389082401, \"Confirmed\": 1359.0, \"Deaths\": 13.0, \"Recovered\": 4.0, \"Long\": 8.20867471, \"Lat\": 46.79785878}, {\"Country/Region\": \"US\", \"Confirmed/100k\": 0.8335181673369116, \"Deaths/100k\": 0.01650531024429528, \"Recovered/100k\": 0.0036678467209545055, \"Confirmed\": 2727.0, \"Deaths\": 54.0, \"Recovered\": 12.0, \"Long\": -112.4616737, \"Lat\": 45.6795472}, {\"Country/Region\": \"United Kingdom\", \"Confirmed/100k\": 1.719081584498703, \"Deaths/100k\": 0.031584176093152026, \"Recovered/100k\": 0.028576159322375637, \"Confirmed\": 1143.0, \"Deaths\": 21.0, \"Recovered\": 19.0, \"Long\": -2.86563164, \"Lat\": 54.12387156}]}}, {\"mode\": \"vega-lite\"});\n",
Chandrasekhar Ramakrishnan
committed
"</script>"
],
"text/plain": [
"alt.LayerChart(...)"
]
},
Chandrasekhar Ramakrishnan
committed
"execution_count": 14,
Chandrasekhar Ramakrishnan
committed
"metadata": {},
"output_type": "execute_result"
}
],
"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",
"(bars + text).properties(height=900)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
},
"papermill": {
"duration": 2.488601,
"end_time": "2020-03-15T16:43:47.325947",
Chandrasekhar Ramakrishnan
committed
"environment_variables": {},
"exception": null,
"input_path": "/tmp/e5179t23/notebooks/Dashboard.ipynb",
Chandrasekhar Ramakrishnan
committed
"output_path": "runs/Dashboard.run.ipynb",
"parameters": {
"PAPERMILL_INPUT_PATH": "/tmp/e5179t23/notebooks/Dashboard.ipynb",
Chandrasekhar Ramakrishnan
committed
"PAPERMILL_OUTPUT_PATH": "runs/Dashboard.run.ipynb",
"geodata_path": "/tmp/e5179t23/data/geodata/geo_data.csv",
"rates_folder": "/tmp/e5179t23/data/covid-19_rates",
"ts_folder": "/tmp/e5179t23/data/covid-19_jhu-csse"
Chandrasekhar Ramakrishnan
committed
},
"start_time": "2020-03-15T16:43:44.837346",
Chandrasekhar Ramakrishnan
committed
"version": "1.1.0"
}
},
"nbformat": 4,
"nbformat_minor": 4
}