diff --git a/notebooks/covid-19-italy.ipynb b/notebooks/covid-19-italy.ipynb index 0a3f9db111735479f7b953476adc46f03817719b..8b1a4dca4f40c27a9cf33effb1c4a0693aac4f4a 100644 --- a/notebooks/covid-19-italy.ipynb +++ b/notebooks/covid-19-italy.ipynb @@ -7,7 +7,9 @@ "# COVID-19 Case data for Italy\n", "\n", "Data from [Civil Protection of Italy](https://github.com/pcm-dpc/COVID-19).\n" - ] + ], + "execution_count": null, + "outputs": [] }, { "cell_type": "code", @@ -59,7 +61,7 @@ }, "outputs": [], "source": [ - "data_folder = \"../../data/covid-19-italy/\"" + "data_folder = \"../data/covid-19-italy/\"" ] }, { @@ -92,7 +94,9 @@ "metadata": {}, "source": [ "## National summary of total cases and tests" - ] + ], + "execution_count": null, + "outputs": [] }, { "cell_type": "code", @@ -172,7 +176,9 @@ "metadata": {}, "source": [ "## Cases per region" - ] + ], + "execution_count": null, + "outputs": [] }, { "cell_type": "code", @@ -188,10 +194,11 @@ " width=150,\n", " height=150)\n", "totals = alt.layer(total, death)\n", - "chart = totals.facet(facet='region', \n", - " columns=5, \n", - " align='each', \n", - " title='Total cases (orange) and deaths (black) by region'\n", + "chart = totals.facet(\n", + " facet='region', \n", + " columns=5, \n", + " align='each', \n", + " title='Total cases (orange) and deaths (black) by region',\n", ").configure_title(\n", " anchor='middle'\n", ")\n", @@ -233,7 +240,8 @@ "# compute daily differences\n", "tdf = df_regions.sort_values(['region', 'date'], ascending=[True, False]).set_index(['region', 'date'])\n", "diffs_df = tdf[['total_cases', 'dead']].groupby(level='region').diff(periods=-1).dropna(how='all')\n", - "tdf_diff=tdf.join(diffs_df, rsuffix='_diff').reset_index()\n" + "tdf_diff=tdf.join(diffs_df, rsuffix='_diff').reset_index()\n", + "" ] }, { @@ -275,7 +283,9 @@ "## Rates of growth\n", "\n", "How quickly is the infection spreading? The charts below show data for all of the regions of Italy framed by some illustrative guiding lines to give an idea of how the rate of infection is evolving. " - ] + ], + "execution_count": null, + "outputs": [] }, { "cell_type": "code", @@ -301,7 +311,13 @@ " height=450\n", ")\n", "\n", - "rule_chart = plotting.make_rule_chart(max_case=110000, max_days=40, pos_day=(12,50000), pos_3days=(35,300000), pos_week=(40,2000))\n", + "rule_chart = plotting.make_rule_chart(\n", + " max_case=110000, \n", + " max_days=int(since_100th_case['sinceDay0'].max()), \n", + " pos_day=(12,50000), \n", + " pos_3days=(35,300000), \n", + " pos_week=(40,2000)\n", + ")\n", "\n", "# add the total cases for italy to the chart\n", "since_100th_case_all = helper.make_since_df(df_national, start_case=100, column='total_cases', region_column='country_code')\n", @@ -339,7 +355,7 @@ "rule_chart = plotting.make_rule_chart(\n", " start_case=10, \n", " max_case=50000, \n", - " max_days=40, \n", + " max_days=int(since_10th_death['sinceDay0'].max()), \n", " pos_day=(12,50000), \n", " pos_3days=(35,20000), \n", " pos_week=(40,100)) \n", @@ -379,9 +395,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.3" + "version": "3.7.7-final" } }, "nbformat": 4, "nbformat_minor": 4 -} +} \ No newline at end of file