{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## The New York Times Covid-19 Database\n", "\n", "The New York Times Covid-19 Database is \n", "a county-level database of confirmed cases and deaths, \n", "compiled from state and local governments and health departments across the United States.\n", "The initial release of the database was on Thursday, March 26, 2020, and it is updated daily. \n", "\n", "These data have fueled many articles and graphics by The Times; these are updated regularly at\n", "[https://www.nytimes.com/interactive/2020/us/coronavirus-us-cases.html](https://www.nytimes.com/interactive/2020/us/coronavirus-us-cases.html). \n", "The Times has created many visualizations that are effective communications of important information about the pandemic. \n", "\n", "The data are publically available via GitHub: [https://github.com/nytimes/covid-19-data](https://www.nytimes.com/interactive/2020/us/coronavirus-us-cases.html). In this illustration we will only use\n", "the data aggregated at the state level. " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from datascience import *\n", "import numpy as np\n", "\n", "%matplotlib inline\n", "import matplotlib.pyplot as plots\n", "plots.style.use('fivethirtyeight')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "covid_table = Table.read_table(\"https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-states.csv\")\n", "covid_table = covid_table.drop('fips')\n", "covid_table" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Process the recent data\n", "\n", "Let's plot Covid-19 statistics for Connecticut. We could also only use data after a particular date. " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "\n", "\n", "\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Let's look at new cases rather than the cumulative number of cases\n", "# we can use the np.diff() function to get the number of new cases each day\n", "\n", "\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "### Can we add new cases to our state_data Table? \n", "# state_data.with_column(\"new cases\", num_new_cases)\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# let's examine now many entries there are in new cases vs. the number of rows in the state_data table\n", "\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# let's add an extra 0 to make num_new_cases vector the same length as the number of rows in the state_data Table \n", "\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# let's add the number of new cases to our Table\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# create line plot treating date \n", "\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# visualizating data treating date as a categorical variable\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Compare this to the graph here: [https://github.com/nytimes/covid-19-data](https://www.nytimes.com/interactive/2020/us/coronavirus-us-cases.html).\n", "\n", "Now, your task is to modify the above code in order to display a plot of the new *deaths* each day. (Hint: You only need to change one word!) What stands out to you upon comparing the plots of new cases and new deaths? \n" ] } ], "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.3" } }, "nbformat": 4, "nbformat_minor": 4 }