From 5e07ce3c7b4586390106323ce2f7faaf6783b7e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rok=20Ro=C5=A1kar?= <rok.roskar@sdsc.ethz.ch> Date: Fri, 20 Mar 2020 15:53:41 +0000 Subject: [PATCH] update covidtracking example notebook --- .../examples/covidtracking-example.ipynb | 978 ++++-------------- 1 file changed, 203 insertions(+), 775 deletions(-) diff --git a/notebooks/examples/covidtracking-example.ipynb b/notebooks/examples/covidtracking-example.ipynb index 89fa1b8d..74c3ce4d 100644 --- a/notebooks/examples/covidtracking-example.ipynb +++ b/notebooks/examples/covidtracking-example.ipynb @@ -2,12 +2,25 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 60, "metadata": {}, - "outputs": [], + "outputs": [ + { + "ename": "ModuleNotFoundError", + "evalue": "No module named 'matplotlib'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m<ipython-input-60-ffb398b1b277>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mpandas\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mpd\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0maltair\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0malt\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0;32mimport\u001b[0m \u001b[0mmatplotlib\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'matplotlib'" + ] + } + ], "source": [ "import pandas as pd\n", - "import altair as alt" + "import altair as alt\n", + "import matplotlib" ] }, { @@ -53,8 +66,9 @@ " <tr style=\"text-align: right;\">\n", " <th></th>\n", " <th>state</th>\n", - " <th>dataSite</th>\n", + " <th>covid19SiteOld</th>\n", " <th>covid19Site</th>\n", + " <th>covid19SiteSecondary</th>\n", " <th>twitter</th>\n", " <th>pui</th>\n", " <th>pum</th>\n", @@ -68,6 +82,7 @@ " <td>AK</td>\n", " <td>http://dhss.alaska.gov/dph/Epi/id/Pages/COVID-...</td>\n", " <td>http://dhss.alaska.gov/dph/Epi/id/Pages/COVID-...</td>\n", + " <td>NaN</td>\n", " <td>@Alaska_DHSS</td>\n", " <td>All data</td>\n", " <td>False</td>\n", @@ -78,7 +93,8 @@ " <th>1</th>\n", " <td>AL</td>\n", " <td>http://www.alabamapublichealth.gov/infectiousd...</td>\n", - " <td>http://www.alabamapublichealth.gov/infectiousd...</td>\n", + " <td>https://alpublichealth.maps.arcgis.com/apps/op...</td>\n", + " <td>NaN</td>\n", " <td>@alpublichealth</td>\n", " <td>No data</td>\n", " <td>False</td>\n", @@ -90,6 +106,7 @@ " <td>AR</td>\n", " <td>https://www.healthy.arkansas.gov/programs-serv...</td>\n", " <td>https://www.healthy.arkansas.gov/programs-serv...</td>\n", + " <td>NaN</td>\n", " <td>@adhpio</td>\n", " <td>All data</td>\n", " <td>True</td>\n", @@ -101,6 +118,7 @@ " <td>AZ</td>\n", " <td>https://www.azdhs.gov/preparedness/epidemiolog...</td>\n", " <td>https://www.azdhs.gov/preparedness/epidemiolog...</td>\n", + " <td>NaN</td>\n", " <td>@azdhs</td>\n", " <td>All data</td>\n", " <td>False</td>\n", @@ -111,7 +129,8 @@ " <th>4</th>\n", " <td>CA</td>\n", " <td>https://www.cdph.ca.gov/Programs/CID/DCDC/Page...</td>\n", - " <td>https://www.cdph.ca.gov/Programs/CID/DCDC/Page...</td>\n", + " <td>https://www.latimes.com/projects/california-co...</td>\n", + " <td>NaN</td>\n", " <td>@CAPublicHealth</td>\n", " <td>Only positives</td>\n", " <td>False</td>\n", @@ -123,33 +142,33 @@ "</div>" ], "text/plain": [ - " state dataSite \\\n", + " state covid19SiteOld \\\n", "0 AK http://dhss.alaska.gov/dph/Epi/id/Pages/COVID-... \n", "1 AL http://www.alabamapublichealth.gov/infectiousd... \n", "2 AR https://www.healthy.arkansas.gov/programs-serv... \n", "3 AZ https://www.azdhs.gov/preparedness/epidemiolog... \n", "4 CA https://www.cdph.ca.gov/Programs/CID/DCDC/Page... \n", "\n", - " covid19Site twitter \\\n", - "0 http://dhss.alaska.gov/dph/Epi/id/Pages/COVID-... @Alaska_DHSS \n", - "1 http://www.alabamapublichealth.gov/infectiousd... @alpublichealth \n", - "2 https://www.healthy.arkansas.gov/programs-serv... @adhpio \n", - "3 https://www.azdhs.gov/preparedness/epidemiolog... @azdhs \n", - "4 https://www.cdph.ca.gov/Programs/CID/DCDC/Page... @CAPublicHealth \n", + " covid19Site covid19SiteSecondary \\\n", + "0 http://dhss.alaska.gov/dph/Epi/id/Pages/COVID-... NaN \n", + "1 https://alpublichealth.maps.arcgis.com/apps/op... NaN \n", + "2 https://www.healthy.arkansas.gov/programs-serv... NaN \n", + "3 https://www.azdhs.gov/preparedness/epidemiolog... NaN \n", + "4 https://www.latimes.com/projects/california-co... NaN \n", "\n", - " pui pum notes \\\n", - "0 All data False Unclear if their reported number means \"person... \n", - "1 No data False Last negative count from 3/16. \n", - "2 All data True Pending = \"PUIs\" \n", - "3 All data False Negative = “Ruled Outâ€. Our total is slightly ... \n", - "4 Only positives False Only positives reported regularly. Add deaths ... \n", + " twitter pui pum \\\n", + "0 @Alaska_DHSS All data False \n", + "1 @alpublichealth No data False \n", + "2 @adhpio All data True \n", + "3 @azdhs All data False \n", + "4 @CAPublicHealth Only positives False \n", "\n", - " name \n", - "0 Alaska \n", - "1 Alabama \n", - "2 Arkansas \n", - "3 Arizona \n", - "4 California " + " notes name \n", + "0 Unclear if their reported number means \"person... Alaska \n", + "1 Last negative count from 3/16. Alabama \n", + "2 Pending = \"PUIs\" Arkansas \n", + "3 Negative = “Ruled Outâ€. Our total is slightly ... Arizona \n", + "4 Only positives reported regularly. Add deaths ... California " ] }, "execution_count": 3, @@ -170,7 +189,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 222, "metadata": {}, "outputs": [], "source": [ @@ -180,7 +199,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 223, "metadata": {}, "outputs": [ { @@ -217,80 +236,80 @@ " <tbody>\n", " <tr>\n", " <th>0</th>\n", - " <td>2020-03-18</td>\n", + " <td>2020-03-19</td>\n", " <td>AK</td>\n", - " <td>6.0</td>\n", - " <td>406.0</td>\n", + " <td>6</td>\n", + " <td>400.0</td>\n", " <td>NaN</td>\n", " <td>NaN</td>\n", - " <td>412.0</td>\n", - " <td>2020-03-18T20:00:00Z</td>\n", + " <td>406</td>\n", + " <td>2020-03-19T20:00:00Z</td>\n", " </tr>\n", " <tr>\n", " <th>1</th>\n", - " <td>2020-03-18</td>\n", + " <td>2020-03-19</td>\n", " <td>AL</td>\n", - " <td>46.0</td>\n", + " <td>68</td>\n", " <td>28.0</td>\n", " <td>NaN</td>\n", " <td>0.0</td>\n", - " <td>74.0</td>\n", - " <td>2020-03-18T20:00:00Z</td>\n", + " <td>96</td>\n", + " <td>2020-03-19T20:00:00Z</td>\n", " </tr>\n", " <tr>\n", " <th>2</th>\n", - " <td>2020-03-18</td>\n", + " <td>2020-03-19</td>\n", " <td>AR</td>\n", - " <td>33.0</td>\n", - " <td>236.0</td>\n", - " <td>50.0</td>\n", + " <td>46</td>\n", + " <td>310.0</td>\n", + " <td>113.0</td>\n", " <td>NaN</td>\n", - " <td>319.0</td>\n", - " <td>2020-03-18T20:00:00Z</td>\n", + " <td>469</td>\n", + " <td>2020-03-19T20:00:00Z</td>\n", " </tr>\n", " <tr>\n", " <th>3</th>\n", - " <td>2020-03-18</td>\n", - " <td>AZ</td>\n", - " <td>28.0</td>\n", - " <td>148.0</td>\n", - " <td>102.0</td>\n", + " <td>2020-03-19</td>\n", + " <td>AS</td>\n", + " <td>0</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", " <td>0.0</td>\n", - " <td>278.0</td>\n", - " <td>2020-03-18T20:00:00Z</td>\n", + " <td>0</td>\n", + " <td>2020-03-19T20:00:00Z</td>\n", " </tr>\n", " <tr>\n", " <th>4</th>\n", - " <td>2020-03-18</td>\n", - " <td>CA</td>\n", - " <td>611.0</td>\n", - " <td>7981.0</td>\n", - " <td>NaN</td>\n", - " <td>13.0</td>\n", - " <td>8592.0</td>\n", - " <td>2020-03-18T20:00:00Z</td>\n", + " <td>2020-03-19</td>\n", + " <td>AZ</td>\n", + " <td>44</td>\n", + " <td>175.0</td>\n", + " <td>130.0</td>\n", + " <td>0.0</td>\n", + " <td>349</td>\n", + " <td>2020-03-19T20:00:00Z</td>\n", " </tr>\n", " </tbody>\n", "</table>\n", "</div>" ], "text/plain": [ - " date state positive negative pending death total \\\n", - "0 2020-03-18 AK 6.0 406.0 NaN NaN 412.0 \n", - "1 2020-03-18 AL 46.0 28.0 NaN 0.0 74.0 \n", - "2 2020-03-18 AR 33.0 236.0 50.0 NaN 319.0 \n", - "3 2020-03-18 AZ 28.0 148.0 102.0 0.0 278.0 \n", - "4 2020-03-18 CA 611.0 7981.0 NaN 13.0 8592.0 \n", + " date state positive negative pending death total \\\n", + "0 2020-03-19 AK 6 400.0 NaN NaN 406 \n", + "1 2020-03-19 AL 68 28.0 NaN 0.0 96 \n", + "2 2020-03-19 AR 46 310.0 113.0 NaN 469 \n", + "3 2020-03-19 AS 0 NaN NaN 0.0 0 \n", + "4 2020-03-19 AZ 44 175.0 130.0 0.0 349 \n", "\n", " dateChecked \n", - "0 2020-03-18T20:00:00Z \n", - "1 2020-03-18T20:00:00Z \n", - "2 2020-03-18T20:00:00Z \n", - "3 2020-03-18T20:00:00Z \n", - "4 2020-03-18T20:00:00Z " + "0 2020-03-19T20:00:00Z \n", + "1 2020-03-19T20:00:00Z \n", + "2 2020-03-19T20:00:00Z \n", + "3 2020-03-19T20:00:00Z \n", + "4 2020-03-19T20:00:00Z " ] }, - "execution_count": 11, + "execution_count": 223, "metadata": {}, "output_type": "execute_result" } @@ -303,735 +322,144 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## How many data points per state?" + "### Daily counts and totals" ] }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 257, + "metadata": {}, + "outputs": [], + "source": [ + "# compute daily differences\n", + "tdf = data_df.sort_values(['state', 'date'], ascending=[True, False]).set_index(['state', 'date'])\n", + "diffs_df = tdf[['positive', 'negative', 'death']].groupby(level='state').diff(periods=-1).dropna(how='all')\n", + "tdf_diff=tdf.join(diffs_df, rsuffix='_diff').reset_index()" + ] + }, + { + "cell_type": "code", + "execution_count": 276, + "metadata": {}, + "outputs": [], + "source": [ + "# \"Normalizing\" the totals\n", + "tdf_diff['total_10'] = tdf_diff['total']/10." + ] + }, + { + "cell_type": "code", + "execution_count": 278, "metadata": {}, "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/opt/conda/lib/python3.7/site-packages/ipykernel_launcher.py:7: SettingWithCopyWarning: \n", + "A value is trying to be set on a copy of a slice from a DataFrame.\n", + "Try using .loc[row_indexer,col_indexer] = value instead\n", + "\n", + "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", + " import sys\n", + "/opt/conda/lib/python3.7/site-packages/ipykernel_launcher.py:9: SettingWithCopyWarning: \n", + "A value is trying to be set on a copy of a slice from a DataFrame.\n", + "Try using .loc[row_indexer,col_indexer] = value instead\n", + "\n", + "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", + " if __name__ == '__main__':\n" + ] + }, { "data": { "text/html": [ - "<div>\n", - "<style scoped>\n", - " .dataframe tbody tr th:only-of-type {\n", - " vertical-align: middle;\n", + "\n", + "<div id=\"altair-viz-a2f753a0d34f48da9107b4032abab8e2\"></div>\n", + "<script type=\"text/javascript\">\n", + " (function(spec, embedOpt){\n", + " const outputDiv = document.getElementById(\"altair-viz-a2f753a0d34f48da9107b4032abab8e2\");\n", + " 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", - " .dataframe tbody tr th {\n", - " vertical-align: top;\n", + " function showError(err) {\n", + " outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n", + " throw err;\n", " }\n", "\n", - " .dataframe thead th {\n", - " text-align: right;\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", - "</style>\n", - "<table border=\"1\" class=\"dataframe\">\n", - " <thead>\n", - " <tr style=\"text-align: right;\">\n", - " <th></th>\n", - " <th>state</th>\n", - " <th>date</th>\n", - " <th>positive</th>\n", - " <th>negative</th>\n", - " <th>pending</th>\n", - " <th>death</th>\n", - " <th>total</th>\n", - " <th>dateChecked</th>\n", - " </tr>\n", - " </thead>\n", - " <tbody>\n", - " <tr>\n", - " <th>4</th>\n", - " <td>AZ</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " <td>6</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " </tr>\n", - " <tr>\n", - " <th>5</th>\n", - " <td>CA</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " <td>0</td>\n", - " <td>7</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " </tr>\n", - " <tr>\n", - " <th>10</th>\n", - " <td>FL</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " <td>14</td>\n", - " <td>8</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " </tr>\n", - " <tr>\n", - " <th>11</th>\n", - " <td>GA</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " <td>1</td>\n", - " <td>0</td>\n", - " <td>6</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " </tr>\n", - " <tr>\n", - " <th>16</th>\n", - " <td>IL</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " <td>12</td>\n", - " <td>2</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " </tr>\n", - " <tr>\n", - " <th>21</th>\n", - " <td>MA</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " <td>6</td>\n", - " <td>0</td>\n", - " <td>0</td>\n", - " <td>14</td>\n", - " <td>15</td>\n", - " </tr>\n", - " <tr>\n", - " <th>30</th>\n", - " <td>NC</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " <td>7</td>\n", - " <td>2</td>\n", - " <td>3</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " </tr>\n", - " <tr>\n", - " <th>33</th>\n", - " <td>NH</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " <td>0</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " </tr>\n", - " <tr>\n", - " <th>37</th>\n", - " <td>NY</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " <td>13</td>\n", - " <td>4</td>\n", - " <td>4</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " </tr>\n", - " <tr>\n", - " <th>40</th>\n", - " <td>OR</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " <td>1</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " </tr>\n", - " <tr>\n", - " <th>44</th>\n", - " <td>SC</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " <td>3</td>\n", - " <td>3</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " </tr>\n", - " <tr>\n", - " <th>47</th>\n", - " <td>TX</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " <td>2</td>\n", - " <td>0</td>\n", - " <td>2</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " </tr>\n", - " <tr>\n", - " <th>52</th>\n", - " <td>WA</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " <td>13</td>\n", - " <td>2</td>\n", - " <td>8</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " </tr>\n", - " <tr>\n", - " <th>53</th>\n", - " <td>WI</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " <td>5</td>\n", - " <td>0</td>\n", - " <td>15</td>\n", - " <td>15</td>\n", - " </tr>\n", - " <tr>\n", - " <th>6</th>\n", - " <td>CO</td>\n", - " <td>14</td>\n", - " <td>14</td>\n", - " <td>14</td>\n", - " <td>4</td>\n", - " <td>5</td>\n", - " <td>14</td>\n", - " <td>14</td>\n", - " </tr>\n", - " <tr>\n", - " <th>8</th>\n", - " <td>DC</td>\n", - " <td>14</td>\n", - " <td>14</td>\n", - " <td>14</td>\n", - " <td>12</td>\n", - " <td>0</td>\n", - " <td>14</td>\n", - " <td>14</td>\n", - " </tr>\n", - " <tr>\n", - " <th>22</th>\n", - " <td>MD</td>\n", - " <td>14</td>\n", - " <td>14</td>\n", - " <td>14</td>\n", - " <td>2</td>\n", - " <td>0</td>\n", - " <td>14</td>\n", - " <td>14</td>\n", - " </tr>\n", - " <tr>\n", - " <th>24</th>\n", - " <td>MI</td>\n", - " <td>14</td>\n", - " <td>14</td>\n", - " <td>14</td>\n", - " <td>12</td>\n", - " <td>0</td>\n", - " <td>14</td>\n", - " <td>14</td>\n", - " </tr>\n", - " <tr>\n", - " <th>32</th>\n", - " <td>NE</td>\n", - " <td>14</td>\n", - " <td>14</td>\n", - " <td>14</td>\n", - " <td>11</td>\n", - " <td>0</td>\n", - " <td>14</td>\n", - " <td>14</td>\n", - " </tr>\n", - " <tr>\n", - " <th>34</th>\n", - " <td>NJ</td>\n", - " <td>14</td>\n", - " <td>14</td>\n", - " <td>9</td>\n", - " <td>12</td>\n", - " <td>8</td>\n", - " <td>14</td>\n", - " <td>14</td>\n", - " </tr>\n", - " <tr>\n", - " <th>36</th>\n", - " <td>NV</td>\n", - " <td>14</td>\n", - " <td>14</td>\n", - " <td>14</td>\n", - " <td>1</td>\n", - " <td>3</td>\n", - " <td>14</td>\n", - " <td>14</td>\n", - " </tr>\n", - " <tr>\n", - " <th>38</th>\n", - " <td>OH</td>\n", - " <td>14</td>\n", - " <td>14</td>\n", - " <td>14</td>\n", - " <td>12</td>\n", - " <td>0</td>\n", - " <td>14</td>\n", - " <td>14</td>\n", - " </tr>\n", - " <tr>\n", - " <th>46</th>\n", - " <td>TN</td>\n", - " <td>14</td>\n", - " <td>14</td>\n", - " <td>8</td>\n", - " <td>0</td>\n", - " <td>0</td>\n", - " <td>14</td>\n", - " <td>14</td>\n", - " </tr>\n", - " <tr>\n", - " <th>49</th>\n", - " <td>VA</td>\n", - " <td>14</td>\n", - " <td>14</td>\n", - " <td>14</td>\n", - " <td>5</td>\n", - " <td>4</td>\n", - " <td>13</td>\n", - " <td>14</td>\n", - " </tr>\n", - " <tr>\n", - " <th>0</th>\n", - " <td>AK</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " <td>7</td>\n", - " <td>0</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " </tr>\n", - " <tr>\n", - " <th>2</th>\n", - " <td>AR</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " <td>0</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " </tr>\n", - " <tr>\n", - " <th>9</th>\n", - " <td>DE</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " <td>11</td>\n", - " <td>0</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " </tr>\n", - " <tr>\n", - " <th>14</th>\n", - " <td>IA</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " <td>8</td>\n", - " <td>0</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " </tr>\n", - " <tr>\n", - " <th>17</th>\n", - " <td>IN</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " <td>9</td>\n", - " <td>0</td>\n", - " <td>5</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " </tr>\n", - " <tr>\n", - " <th>18</th>\n", - " <td>KS</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " <td>5</td>\n", - " <td>5</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " </tr>\n", - " <tr>\n", - " <th>19</th>\n", - " <td>KY</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " <td>1</td>\n", - " <td>3</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " </tr>\n", - " <tr>\n", - " <th>25</th>\n", - " <td>MN</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " <td>0</td>\n", - " <td>0</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " </tr>\n", - " <tr>\n", - " <th>35</th>\n", - " <td>NM</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " <td>4</td>\n", - " <td>0</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " </tr>\n", - " <tr>\n", - " <th>41</th>\n", - " <td>PA</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " <td>8</td>\n", - " <td>5</td>\n", - " <td>0</td>\n", - " <td>12</td>\n", - " <td>13</td>\n", - " </tr>\n", - " <tr>\n", - " <th>51</th>\n", - " <td>VT</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " <td>0</td>\n", - " <td>0</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " </tr>\n", - " <tr>\n", - " <th>54</th>\n", - " <td>WV</td>\n", - " <td>13</td>\n", - " <td>12</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " <td>4</td>\n", - " <td>13</td>\n", - " <td>13</td>\n", - " </tr>\n", - " <tr>\n", - " <th>1</th>\n", - " <td>AL</td>\n", - " <td>12</td>\n", - " <td>11</td>\n", - " <td>9</td>\n", - " <td>4</td>\n", - " <td>4</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " </tr>\n", - " <tr>\n", - " <th>7</th>\n", - " <td>CT</td>\n", - " <td>12</td>\n", - " <td>11</td>\n", - " <td>11</td>\n", - " <td>1</td>\n", - " <td>0</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " </tr>\n", - " <tr>\n", - " <th>13</th>\n", - " <td>HI</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " <td>1</td>\n", - " <td>1</td>\n", - " <td>0</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " </tr>\n", - " <tr>\n", - " <th>15</th>\n", - " <td>ID</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " <td>0</td>\n", - " <td>0</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " </tr>\n", - " <tr>\n", - " <th>20</th>\n", - " <td>LA</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " <td>11</td>\n", - " <td>0</td>\n", - " <td>4</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " </tr>\n", - " <tr>\n", - " <th>23</th>\n", - " <td>ME</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " <td>6</td>\n", - " <td>0</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " </tr>\n", - " <tr>\n", - " <th>26</th>\n", - " <td>MO</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " <td>7</td>\n", - " <td>0</td>\n", - " <td>5</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " </tr>\n", - " <tr>\n", - " <th>28</th>\n", - " <td>MS</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " <td>8</td>\n", - " <td>0</td>\n", - " <td>0</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " </tr>\n", - " <tr>\n", - " <th>29</th>\n", - " <td>MT</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " <td>5</td>\n", - " <td>0</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " </tr>\n", - " <tr>\n", - " <th>31</th>\n", - " <td>ND</td>\n", - " <td>12</td>\n", - " <td>11</td>\n", - " <td>12</td>\n", - " <td>8</td>\n", - " <td>6</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " </tr>\n", - " <tr>\n", - " <th>39</th>\n", - " <td>OK</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " <td>11</td>\n", - " <td>11</td>\n", - " <td>0</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " </tr>\n", - " <tr>\n", - " <th>43</th>\n", - " <td>RI</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " <td>11</td>\n", - " <td>11</td>\n", - " <td>0</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " </tr>\n", - " <tr>\n", - " <th>45</th>\n", - " <td>SD</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " <td>1</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " </tr>\n", - " <tr>\n", - " <th>48</th>\n", - " <td>UT</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " <td>7</td>\n", - " <td>0</td>\n", - " <td>4</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " </tr>\n", - " <tr>\n", - " <th>55</th>\n", - " <td>WY</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " <td>3</td>\n", - " <td>1</td>\n", - " <td>0</td>\n", - " <td>12</td>\n", - " <td>12</td>\n", - " </tr>\n", - " <tr>\n", - " <th>3</th>\n", - " <td>AS</td>\n", - " <td>3</td>\n", - " <td>3</td>\n", - " <td>0</td>\n", - " <td>0</td>\n", - " <td>1</td>\n", - " <td>3</td>\n", - " <td>3</td>\n", - " </tr>\n", - " <tr>\n", - " <th>12</th>\n", - " <td>GU</td>\n", - " <td>3</td>\n", - " <td>3</td>\n", - " <td>3</td>\n", - " <td>0</td>\n", - " <td>0</td>\n", - " <td>3</td>\n", - " <td>3</td>\n", - " </tr>\n", - " <tr>\n", - " <th>27</th>\n", - " <td>MP</td>\n", - " <td>3</td>\n", - " <td>3</td>\n", - " <td>0</td>\n", - " <td>0</td>\n", - " <td>1</td>\n", - " <td>3</td>\n", - " <td>3</td>\n", - " </tr>\n", - " <tr>\n", - " <th>42</th>\n", - " <td>PR</td>\n", - " <td>3</td>\n", - " <td>3</td>\n", - " <td>3</td>\n", - " <td>2</td>\n", - " <td>0</td>\n", - " <td>3</td>\n", - " <td>3</td>\n", - " </tr>\n", - " <tr>\n", - " <th>50</th>\n", - " <td>VI</td>\n", - " <td>3</td>\n", - " <td>3</td>\n", - " <td>0</td>\n", - " <td>0</td>\n", - " <td>1</td>\n", - " <td>3</td>\n", - " <td>3</td>\n", - " </tr>\n", - " </tbody>\n", - "</table>\n", - "</div>" + "\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}}, \"hconcat\": [{\"layer\": [{\"mark\": {\"type\": \"bar\", \"size\": 10}, \"encoding\": {\"x\": {\"type\": \"temporal\", \"axis\": {\"title\": \"Date\"}, \"field\": \"date\"}, \"y\": {\"type\": \"quantitative\", \"axis\": {\"title\": \"Daily positive\"}, \"field\": \"daily_positive\"}}, \"height\": 150, \"title\": \"WA\", \"width\": 250}, {\"layer\": [{\"mark\": {\"type\": \"line\", \"color\": \"red\"}, \"encoding\": {\"x\": {\"type\": \"temporal\", \"axis\": {\"title\": \"Date\"}, \"field\": \"date\"}, \"y\": {\"type\": \"quantitative\", \"axis\": {\"title\": \"Total/10\"}, \"field\": \"total_10\"}}, \"height\": 150, \"title\": \"WA\", \"width\": 250}, {\"mark\": {\"type\": \"line\", \"color\": \"orange\"}, \"encoding\": {\"x\": {\"type\": \"temporal\", \"axis\": {\"title\": \"Date\"}, \"field\": \"date\"}, \"y\": {\"type\": \"quantitative\", \"axis\": {\"title\": \"Positive\"}, \"field\": \"positive\"}}, \"height\": 150, \"title\": \"WA\", \"width\": 250}]}], \"data\": {\"name\": \"data-e3884ceed25bdc83e388c03b5394d76a\"}, \"resolve\": {\"scale\": {\"y\": \"independent\"}}}, {\"layer\": [{\"mark\": {\"type\": \"bar\", \"size\": 10}, \"encoding\": {\"x\": {\"type\": \"temporal\", \"axis\": {\"title\": \"Date\"}, \"field\": \"date\"}, \"y\": {\"type\": \"quantitative\", \"axis\": {\"title\": \"Daily positive\"}, \"field\": \"daily_positive\"}}, \"height\": 150, \"title\": \"CA\", \"width\": 250}, {\"layer\": [{\"mark\": {\"type\": \"line\", \"color\": \"red\"}, \"encoding\": {\"x\": {\"type\": \"temporal\", \"axis\": {\"title\": \"Date\"}, \"field\": \"date\"}, \"y\": {\"type\": \"quantitative\", \"axis\": {\"title\": \"Total/10\"}, \"field\": \"total_10\"}}, \"height\": 150, \"title\": \"CA\", \"width\": 250}, {\"mark\": {\"type\": \"line\", \"color\": \"orange\"}, \"encoding\": {\"x\": {\"type\": \"temporal\", \"axis\": {\"title\": \"Date\"}, \"field\": \"date\"}, \"y\": {\"type\": \"quantitative\", \"axis\": {\"title\": \"Positive\"}, \"field\": \"positive\"}}, \"height\": 150, \"title\": \"CA\", \"width\": 250}]}], \"data\": {\"name\": \"data-5524f3d9a011a4455f9aef2d5f2b332f\"}, \"resolve\": {\"scale\": {\"y\": \"independent\"}}}, {\"layer\": [{\"mark\": {\"type\": \"bar\", \"size\": 10}, \"encoding\": {\"x\": {\"type\": \"temporal\", \"axis\": {\"title\": \"Date\"}, \"field\": \"date\"}, \"y\": {\"type\": \"quantitative\", \"axis\": {\"title\": \"Daily positive\"}, \"field\": \"daily_positive\"}}, \"height\": 150, \"title\": \"NY\", \"width\": 250}, {\"layer\": [{\"mark\": {\"type\": \"line\", \"color\": \"red\"}, \"encoding\": {\"x\": {\"type\": \"temporal\", \"axis\": {\"title\": \"Date\"}, \"field\": \"date\"}, \"y\": {\"type\": \"quantitative\", \"axis\": {\"title\": \"Total/10\"}, \"field\": \"total_10\"}}, \"height\": 150, \"title\": \"NY\", \"width\": 250}, {\"mark\": {\"type\": \"line\", \"color\": \"orange\"}, \"encoding\": {\"x\": {\"type\": \"temporal\", \"axis\": {\"title\": \"Date\"}, \"field\": \"date\"}, \"y\": {\"type\": \"quantitative\", \"axis\": {\"title\": \"Positive\"}, \"field\": \"positive\"}}, \"height\": 150, \"title\": \"NY\", \"width\": 250}]}], \"data\": {\"name\": \"data-294eebc48941097d786524a29c373ee4\"}, \"resolve\": {\"scale\": {\"y\": \"independent\"}}}], \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-e3884ceed25bdc83e388c03b5394d76a\": [{\"state\": \"WA\", \"date\": \"2020-03-19T00:00:00\", \"positive\": 1187, \"negative\": 15918.0, \"pending\": null, \"death\": 66.0, \"total\": 17105, \"dateChecked\": \"2020-03-19T20:00:00Z\", \"positive_diff\": 175.0, \"negative_diff\": 2801.0, \"death_diff\": 14.0, \"total_10\": 1710.5, \"daily_positive\": 175.0}, {\"state\": \"WA\", \"date\": \"2020-03-18T00:00:00\", \"positive\": 1012, \"negative\": 13117.0, \"pending\": null, \"death\": 52.0, \"total\": 14129, \"dateChecked\": \"2020-03-18T20:00:00Z\", \"positive_diff\": 108.0, \"negative_diff\": 1535.0, \"death_diff\": 4.0, \"total_10\": 1412.9, \"daily_positive\": 108.0}, {\"state\": \"WA\", \"date\": \"2020-03-17T00:00:00\", \"positive\": 904, \"negative\": 11582.0, \"pending\": null, \"death\": 48.0, \"total\": 12486, \"dateChecked\": \"2020-03-17T20:00:00Z\", \"positive_diff\": 135.0, \"negative_diff\": 2131.0, \"death_diff\": 6.0, \"total_10\": 1248.6, \"daily_positive\": 135.0}, {\"state\": \"WA\", \"date\": \"2020-03-16T00:00:00\", \"positive\": 769, \"negative\": 9451.0, \"pending\": null, \"death\": 42.0, \"total\": 10220, \"dateChecked\": \"2020-03-16T20:00:00Z\", \"positive_diff\": 127.0, \"negative_diff\": 2329.0, \"death_diff\": 2.0, \"total_10\": 1022.0, \"daily_positive\": 127.0}, {\"state\": \"WA\", \"date\": \"2020-03-15T00:00:00\", \"positive\": 642, \"negative\": 7122.0, \"pending\": null, \"death\": 40.0, \"total\": 7764, \"dateChecked\": \"2020-03-15T20:00:00Z\", \"positive_diff\": 74.0, \"negative_diff\": 1121.0, \"death_diff\": 3.0, \"total_10\": 776.4, \"daily_positive\": 74.0}, {\"state\": \"WA\", \"date\": \"2020-03-14T00:00:00\", \"positive\": 568, \"negative\": 6001.0, \"pending\": null, \"death\": 37.0, \"total\": 6569, \"dateChecked\": \"2020-03-14T20:00:00Z\", \"positive_diff\": 111.0, \"negative_diff\": 1651.0, \"death_diff\": 6.0, \"total_10\": 656.9, \"daily_positive\": 111.0}, {\"state\": \"WA\", \"date\": \"2020-03-13T00:00:00\", \"positive\": 457, \"negative\": 4350.0, \"pending\": null, \"death\": 31.0, \"total\": 4807, \"dateChecked\": \"2020-03-13T20:00:00Z\", \"positive_diff\": 120.0, \"negative_diff\": 1313.0, \"death_diff\": 2.0, \"total_10\": 480.7, \"daily_positive\": 120.0}, {\"state\": \"WA\", \"date\": \"2020-03-12T00:00:00\", \"positive\": 337, \"negative\": 3037.0, \"pending\": null, \"death\": 29.0, \"total\": 3403, \"dateChecked\": \"2020-03-12T20:00:00Z\", \"positive_diff\": 70.0, \"negative_diff\": 862.0, \"death_diff\": 5.0, \"total_10\": 340.3, \"daily_positive\": 70.0}, {\"state\": \"WA\", \"date\": \"2020-03-11T00:00:00\", \"positive\": 267, \"negative\": 2175.0, \"pending\": null, \"death\": 24.0, \"total\": 2466, \"dateChecked\": \"2020-03-11T20:00:00Z\", \"positive_diff\": 105.0, \"negative_diff\": 1065.0, \"death_diff\": null, \"total_10\": 246.6, \"daily_positive\": 105.0}, {\"state\": \"WA\", \"date\": \"2020-03-10T00:00:00\", \"positive\": 162, \"negative\": 1110.0, \"pending\": null, \"death\": null, \"total\": 1272, \"dateChecked\": \"2020-03-10T20:00:00Z\", \"positive_diff\": 26.0, \"negative_diff\": 0.0, \"death_diff\": null, \"total_10\": 127.2, \"daily_positive\": 26.0}, {\"state\": \"WA\", \"date\": \"2020-03-09T00:00:00\", \"positive\": 136, \"negative\": 1110.0, \"pending\": null, \"death\": null, \"total\": 1246, \"dateChecked\": \"2020-03-09T20:00:00Z\", \"positive_diff\": 34.0, \"negative_diff\": 470.0, \"death_diff\": null, \"total_10\": 124.6, \"daily_positive\": 34.0}, {\"state\": \"WA\", \"date\": \"2020-03-08T00:00:00\", \"positive\": 102, \"negative\": 640.0, \"pending\": 60.0, \"death\": null, \"total\": 802, \"dateChecked\": \"2020-03-08T21:00:00Z\", \"positive_diff\": 0.0, \"negative_diff\": 270.0, \"death_diff\": null, \"total_10\": 80.2, \"daily_positive\": 0.0}, {\"state\": \"WA\", \"date\": \"2020-03-07T00:00:00\", \"positive\": 102, \"negative\": 370.0, \"pending\": 66.0, \"death\": null, \"total\": 538, \"dateChecked\": \"2020-03-07T21:00:00Z\", \"positive_diff\": 23.0, \"negative_diff\": 0.0, \"death_diff\": null, \"total_10\": 53.8, \"daily_positive\": 23.0}, {\"state\": \"WA\", \"date\": \"2020-03-06T00:00:00\", \"positive\": 79, \"negative\": 370.0, \"pending\": null, \"death\": null, \"total\": 449, \"dateChecked\": \"2020-03-06T21:00:00Z\", \"positive_diff\": 9.0, \"negative_diff\": null, \"death_diff\": null, \"total_10\": 44.9, \"daily_positive\": 9.0}, {\"state\": \"WA\", \"date\": \"2020-03-05T00:00:00\", \"positive\": 70, \"negative\": null, \"pending\": null, \"death\": null, \"total\": 70, \"dateChecked\": \"2020-03-05T21:00:00Z\", \"positive_diff\": 31.0, \"negative_diff\": null, \"death_diff\": null, \"total_10\": 7.0, \"daily_positive\": 31.0}, {\"state\": \"WA\", \"date\": \"2020-03-04T00:00:00\", \"positive\": 39, \"negative\": null, \"pending\": null, \"death\": null, \"total\": 39, \"dateChecked\": \"2020-03-04T21:00:00Z\", \"positive_diff\": null, \"negative_diff\": null, \"death_diff\": null, \"total_10\": 3.9, \"daily_positive\": null}], \"data-5524f3d9a011a4455f9aef2d5f2b332f\": [{\"state\": \"CA\", \"date\": \"2020-03-19T00:00:00\", \"positive\": 924, \"negative\": 8787.0, \"pending\": null, \"death\": 18.0, \"total\": 9711, \"dateChecked\": \"2020-03-19T20:00:00Z\", \"positive_diff\": 313.0, \"negative_diff\": 806.0, \"death_diff\": 5.0, \"total_10\": 971.1, \"daily_positive\": 313.0}, {\"state\": \"CA\", \"date\": \"2020-03-18T00:00:00\", \"positive\": 611, \"negative\": 7981.0, \"pending\": null, \"death\": 13.0, \"total\": 8592, \"dateChecked\": \"2020-03-18T20:00:00Z\", \"positive_diff\": 128.0, \"negative_diff\": 0.0, \"death_diff\": 2.0, \"total_10\": 859.2, \"daily_positive\": 128.0}, {\"state\": \"CA\", \"date\": \"2020-03-17T00:00:00\", \"positive\": 483, \"negative\": 7981.0, \"pending\": null, \"death\": 11.0, \"total\": 8407, \"dateChecked\": \"2020-03-17T20:00:00Z\", \"positive_diff\": 148.0, \"negative_diff\": 0.0, \"death_diff\": 5.0, \"total_10\": 840.7, \"daily_positive\": 148.0}, {\"state\": \"CA\", \"date\": \"2020-03-16T00:00:00\", \"positive\": 335, \"negative\": 7981.0, \"pending\": null, \"death\": 6.0, \"total\": 8316, \"dateChecked\": \"2020-03-16T20:00:00Z\", \"positive_diff\": 42.0, \"negative_diff\": 7065.0, \"death_diff\": 1.0, \"total_10\": 831.6, \"daily_positive\": 42.0}, {\"state\": \"CA\", \"date\": \"2020-03-15T00:00:00\", \"positive\": 293, \"negative\": 916.0, \"pending\": null, \"death\": 5.0, \"total\": 1209, \"dateChecked\": \"2020-03-15T20:00:00Z\", \"positive_diff\": 41.0, \"negative_diff\": 0.0, \"death_diff\": 0.0, \"total_10\": 120.9, \"daily_positive\": 41.0}, {\"state\": \"CA\", \"date\": \"2020-03-14T00:00:00\", \"positive\": 252, \"negative\": 916.0, \"pending\": null, \"death\": 5.0, \"total\": 1168, \"dateChecked\": \"2020-03-14T20:00:00Z\", \"positive_diff\": 50.0, \"negative_diff\": 0.0, \"death_diff\": 1.0, \"total_10\": 116.8, \"daily_positive\": 50.0}, {\"state\": \"CA\", \"date\": \"2020-03-13T00:00:00\", \"positive\": 202, \"negative\": 916.0, \"pending\": null, \"death\": 4.0, \"total\": 1118, \"dateChecked\": \"2020-03-13T20:00:00Z\", \"positive_diff\": 0.0, \"negative_diff\": 0.0, \"death_diff\": 0.0, \"total_10\": 111.8, \"daily_positive\": 0.0}, {\"state\": \"CA\", \"date\": \"2020-03-12T00:00:00\", \"positive\": 202, \"negative\": 916.0, \"pending\": null, \"death\": 4.0, \"total\": 1118, \"dateChecked\": \"2020-03-12T20:00:00Z\", \"positive_diff\": 45.0, \"negative_diff\": 0.0, \"death_diff\": null, \"total_10\": 111.8, \"daily_positive\": 45.0}, {\"state\": \"CA\", \"date\": \"2020-03-11T00:00:00\", \"positive\": 157, \"negative\": 916.0, \"pending\": null, \"death\": null, \"total\": 1073, \"dateChecked\": \"2020-03-11T20:00:00Z\", \"positive_diff\": 24.0, \"negative_diff\": 226.0, \"death_diff\": null, \"total_10\": 107.3, \"daily_positive\": 24.0}, {\"state\": \"CA\", \"date\": \"2020-03-10T00:00:00\", \"positive\": 133, \"negative\": 690.0, \"pending\": null, \"death\": null, \"total\": 823, \"dateChecked\": \"2020-03-10T20:00:00Z\", \"positive_diff\": 19.0, \"negative_diff\": 0.0, \"death_diff\": null, \"total_10\": 82.3, \"daily_positive\": 19.0}, {\"state\": \"CA\", \"date\": \"2020-03-09T00:00:00\", \"positive\": 114, \"negative\": 690.0, \"pending\": null, \"death\": null, \"total\": 804, \"dateChecked\": \"2020-03-09T20:00:00Z\", \"positive_diff\": 26.0, \"negative_diff\": 228.0, \"death_diff\": null, \"total_10\": 80.4, \"daily_positive\": 26.0}, {\"state\": \"CA\", \"date\": \"2020-03-08T00:00:00\", \"positive\": 88, \"negative\": 462.0, \"pending\": null, \"death\": null, \"total\": 550, \"dateChecked\": \"2020-03-08T21:00:00Z\", \"positive_diff\": 19.0, \"negative_diff\": 0.0, \"death_diff\": null, \"total_10\": 55.0, \"daily_positive\": 19.0}, {\"state\": \"CA\", \"date\": \"2020-03-07T00:00:00\", \"positive\": 69, \"negative\": 462.0, \"pending\": null, \"death\": null, \"total\": 531, \"dateChecked\": \"2020-03-07T21:00:00Z\", \"positive_diff\": 9.0, \"negative_diff\": 0.0, \"death_diff\": null, \"total_10\": 53.1, \"daily_positive\": 9.0}, {\"state\": \"CA\", \"date\": \"2020-03-06T00:00:00\", \"positive\": 60, \"negative\": 462.0, \"pending\": null, \"death\": null, \"total\": 522, \"dateChecked\": \"2020-03-06T21:00:00Z\", \"positive_diff\": 7.0, \"negative_diff\": 0.0, \"death_diff\": null, \"total_10\": 52.2, \"daily_positive\": 7.0}, {\"state\": \"CA\", \"date\": \"2020-03-05T00:00:00\", \"positive\": 53, \"negative\": 462.0, \"pending\": null, \"death\": null, \"total\": 515, \"dateChecked\": \"2020-03-05T21:00:00Z\", \"positive_diff\": 0.0, \"negative_diff\": 0.0, \"death_diff\": null, \"total_10\": 51.5, \"daily_positive\": 0.0}, {\"state\": \"CA\", \"date\": \"2020-03-04T00:00:00\", \"positive\": 53, \"negative\": 462.0, \"pending\": null, \"death\": null, \"total\": 515, \"dateChecked\": \"2020-03-04T21:00:00Z\", \"positive_diff\": null, \"negative_diff\": null, \"death_diff\": null, \"total_10\": 51.5, \"daily_positive\": null}], \"data-294eebc48941097d786524a29c373ee4\": [{\"state\": \"NY\", \"date\": \"2020-03-19T00:00:00\", \"positive\": 4152, \"negative\": 18132.0, \"pending\": null, \"death\": 12.0, \"total\": 22284, \"dateChecked\": \"2020-03-19T20:00:00Z\", \"positive_diff\": 1770.0, \"negative_diff\": 5917.0, \"death_diff\": 0.0, \"total_10\": 2228.4, \"daily_positive\": 1770.0}, {\"state\": \"NY\", \"date\": \"2020-03-18T00:00:00\", \"positive\": 2382, \"negative\": 12215.0, \"pending\": null, \"death\": 12.0, \"total\": 14597, \"dateChecked\": \"2020-03-18T20:00:00Z\", \"positive_diff\": 682.0, \"negative_diff\": 6709.0, \"death_diff\": 5.0, \"total_10\": 1459.7, \"daily_positive\": 682.0}, {\"state\": \"NY\", \"date\": \"2020-03-17T00:00:00\", \"positive\": 1700, \"negative\": 5506.0, \"pending\": null, \"death\": 7.0, \"total\": 7206, \"dateChecked\": \"2020-03-17T20:00:00Z\", \"positive_diff\": 750.0, \"negative_diff\": 1184.0, \"death_diff\": 0.0, \"total_10\": 720.6, \"daily_positive\": 750.0}, {\"state\": \"NY\", \"date\": \"2020-03-16T00:00:00\", \"positive\": 950, \"negative\": 4322.0, \"pending\": null, \"death\": 7.0, \"total\": 5272, \"dateChecked\": \"2020-03-16T20:00:00Z\", \"positive_diff\": 221.0, \"negative_diff\": -221.0, \"death_diff\": 4.0, \"total_10\": 527.2, \"daily_positive\": 221.0}, {\"state\": \"NY\", \"date\": \"2020-03-15T00:00:00\", \"positive\": 729, \"negative\": 4543.0, \"pending\": null, \"death\": 3.0, \"total\": 5272, \"dateChecked\": \"2020-03-15T20:00:00Z\", \"positive_diff\": 205.0, \"negative_diff\": 1764.0, \"death_diff\": null, \"total_10\": 527.2, \"daily_positive\": 205.0}, {\"state\": \"NY\", \"date\": \"2020-03-14T00:00:00\", \"positive\": 524, \"negative\": 2779.0, \"pending\": null, \"death\": null, \"total\": 3303, \"dateChecked\": \"2020-03-14T20:00:00Z\", \"positive_diff\": 103.0, \"negative_diff\": 0.0, \"death_diff\": null, \"total_10\": 330.3, \"daily_positive\": 103.0}, {\"state\": \"NY\", \"date\": \"2020-03-13T00:00:00\", \"positive\": 421, \"negative\": 2779.0, \"pending\": null, \"death\": null, \"total\": 3200, \"dateChecked\": \"2020-03-13T20:00:00Z\", \"positive_diff\": 205.0, \"negative_diff\": null, \"death_diff\": null, \"total_10\": 320.0, \"daily_positive\": 205.0}, {\"state\": \"NY\", \"date\": \"2020-03-12T00:00:00\", \"positive\": 216, \"negative\": null, \"pending\": null, \"death\": null, \"total\": 216, \"dateChecked\": \"2020-03-12T20:00:00Z\", \"positive_diff\": 0.0, \"negative_diff\": null, \"death_diff\": null, \"total_10\": 21.6, \"daily_positive\": 0.0}, {\"state\": \"NY\", \"date\": \"2020-03-11T00:00:00\", \"positive\": 216, \"negative\": null, \"pending\": null, \"death\": null, \"total\": 216, \"dateChecked\": \"2020-03-11T20:00:00Z\", \"positive_diff\": 43.0, \"negative_diff\": null, \"death_diff\": null, \"total_10\": 21.6, \"daily_positive\": 43.0}, {\"state\": \"NY\", \"date\": \"2020-03-10T00:00:00\", \"positive\": 173, \"negative\": 92.0, \"pending\": null, \"death\": null, \"total\": 265, \"dateChecked\": \"2020-03-10T20:00:00Z\", \"positive_diff\": 31.0, \"negative_diff\": 0.0, \"death_diff\": null, \"total_10\": 26.5, \"daily_positive\": 31.0}, {\"state\": \"NY\", \"date\": \"2020-03-09T00:00:00\", \"positive\": 142, \"negative\": 92.0, \"pending\": null, \"death\": null, \"total\": 234, \"dateChecked\": \"2020-03-09T20:00:00Z\", \"positive_diff\": 37.0, \"negative_diff\": 0.0, \"death_diff\": null, \"total_10\": 23.4, \"daily_positive\": 37.0}, {\"state\": \"NY\", \"date\": \"2020-03-08T00:00:00\", \"positive\": 105, \"negative\": 92.0, \"pending\": null, \"death\": null, \"total\": 197, \"dateChecked\": \"2020-03-08T21:00:00Z\", \"positive_diff\": 29.0, \"negative_diff\": 0.0, \"death_diff\": null, \"total_10\": 19.7, \"daily_positive\": 29.0}, {\"state\": \"NY\", \"date\": \"2020-03-07T00:00:00\", \"positive\": 76, \"negative\": 92.0, \"pending\": 236.0, \"death\": null, \"total\": 404, \"dateChecked\": \"2020-03-07T21:00:00Z\", \"positive_diff\": 43.0, \"negative_diff\": 0.0, \"death_diff\": null, \"total_10\": 40.4, \"daily_positive\": 43.0}, {\"state\": \"NY\", \"date\": \"2020-03-06T00:00:00\", \"positive\": 33, \"negative\": 92.0, \"pending\": 236.0, \"death\": null, \"total\": 361, \"dateChecked\": \"2020-03-06T21:00:00Z\", \"positive_diff\": 11.0, \"negative_diff\": 16.0, \"death_diff\": null, \"total_10\": 36.1, \"daily_positive\": 11.0}, {\"state\": \"NY\", \"date\": \"2020-03-05T00:00:00\", \"positive\": 22, \"negative\": 76.0, \"pending\": 24.0, \"death\": null, \"total\": 122, \"dateChecked\": \"2020-03-05T21:00:00Z\", \"positive_diff\": 16.0, \"negative_diff\": 28.0, \"death_diff\": null, \"total_10\": 12.2, \"daily_positive\": 16.0}, {\"state\": \"NY\", \"date\": \"2020-03-04T00:00:00\", \"positive\": 6, \"negative\": 48.0, \"pending\": 24.0, \"death\": null, \"total\": 78, \"dateChecked\": \"2020-03-04T21:00:00Z\", \"positive_diff\": null, \"negative_diff\": null, \"death_diff\": null, \"total_10\": 7.8, \"daily_positive\": null}]}}, {\"mode\": \"vega-lite\"});\n", + "</script>" ], "text/plain": [ - " state date positive negative pending death total dateChecked\n", - "4 AZ 15 15 15 15 6 15 15\n", - "5 CA 15 15 15 0 7 15 15\n", - "10 FL 15 15 15 14 8 15 15\n", - "11 GA 15 15 1 0 6 15 15\n", - "16 IL 15 15 15 12 2 15 15\n", - "21 MA 15 15 6 0 0 14 15\n", - "30 NC 15 15 7 2 3 15 15\n", - "33 NH 15 15 15 15 0 15 15\n", - "37 NY 15 15 13 4 4 15 15\n", - "40 OR 15 15 15 15 1 15 15\n", - "44 SC 15 15 15 3 3 15 15\n", - "47 TX 15 15 2 0 2 15 15\n", - "52 WA 15 15 13 2 8 15 15\n", - "53 WI 15 15 15 5 0 15 15\n", - "6 CO 14 14 14 4 5 14 14\n", - "8 DC 14 14 14 12 0 14 14\n", - "22 MD 14 14 14 2 0 14 14\n", - "24 MI 14 14 14 12 0 14 14\n", - "32 NE 14 14 14 11 0 14 14\n", - "34 NJ 14 14 9 12 8 14 14\n", - "36 NV 14 14 14 1 3 14 14\n", - "38 OH 14 14 14 12 0 14 14\n", - "46 TN 14 14 8 0 0 14 14\n", - "49 VA 14 14 14 5 4 13 14\n", - "0 AK 13 13 13 7 0 13 13\n", - "2 AR 13 13 13 13 0 13 13\n", - "9 DE 13 13 13 11 0 13 13\n", - "14 IA 13 13 13 8 0 13 13\n", - "17 IN 13 13 9 0 5 13 13\n", - "18 KS 13 13 13 5 5 13 13\n", - "19 KY 13 13 13 1 3 13 13\n", - "25 MN 13 13 13 0 0 13 13\n", - "35 NM 13 13 13 4 0 13 13\n", - "41 PA 13 13 8 5 0 12 13\n", - "51 VT 13 13 13 0 0 13 13\n", - "54 WV 13 12 13 13 4 13 13\n", - "1 AL 12 11 9 4 4 12 12\n", - "7 CT 12 11 11 1 0 12 12\n", - "13 HI 12 12 1 1 0 12 12\n", - "15 ID 12 12 12 0 0 12 12\n", - "20 LA 12 12 11 0 4 12 12\n", - "23 ME 12 12 12 6 0 12 12\n", - "26 MO 12 12 7 0 5 12 12\n", - "28 MS 12 12 8 0 0 12 12\n", - "29 MT 12 12 12 5 0 12 12\n", - "31 ND 12 11 12 8 6 12 12\n", - "39 OK 12 12 11 11 0 12 12\n", - "43 RI 12 12 11 11 0 12 12\n", - "45 SD 12 12 12 12 1 12 12\n", - "48 UT 12 12 7 0 4 12 12\n", - "55 WY 12 12 3 1 0 12 12\n", - "3 AS 3 3 0 0 1 3 3\n", - "12 GU 3 3 3 0 0 3 3\n", - "27 MP 3 3 0 0 1 3 3\n", - "42 PR 3 3 3 2 0 3 3\n", - "50 VI 3 3 0 0 1 3 3" + "alt.HConcatChart(...)" ] }, - "execution_count": 16, + "execution_count": 278, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "summary_df = data_df.groupby('state').count()\n", - "summary_df.reset_index().sort_values(['date', 'state'], ascending=[False, True])" + "# produce the charts for a few states\n", + "\n", + "charts=[]\n", + "for state in ['WA', 'CA', 'NY']: \n", + " state_df = tdf_diff[tdf_diff['state'] == state]\n", + "\n", + " state_df['daily_positive'] = state_df['positive'][::-1].diff()\n", + "\n", + " state_df['total_10'] = state_df['total']/10.\n", + "\n", + " base = alt.Chart(state_df, title=state).encode(alt.X('date', axis=alt.Axis(title='Date'))).properties(width=250, height=150)\n", + " dailies = base.mark_bar(size=10).encode(alt.Y('daily_positive', axis=alt.Axis(title='Daily positive')))\n", + "\n", + " totals = base.mark_line(color='red').encode(alt.Y('total_10', axis=alt.Axis(title='Total/10'))) \n", + " positives = totals.mark_line(color='orange').encode(alt.Y('positive', axis=alt.Axis(title='Positive')))\n", + " cumulative = totals + positives\n", + "\n", + " charts.append(alt.layer(dailies, cumulative).resolve_scale(y='independent'))\n", + "\n", + "\n", + "alt.hconcat(*charts)" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { @@ -1050,7 +478,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.6" + "version": "3.7.3" } }, "nbformat": 4, -- GitLab