Author: Ken Blake, Ph.D.

Description: This script will read the latest data from the New York Times' county-level COVID-19 database at https://github.com/nytimes/covid-19-data/blob/master/us-counties.csv, filter the data for a chosen state, and save the data for all counties in the state to a comma-separated value (.csv) file on your computer.

Note: For information about the data, see https://github.com/nytimes/covid-19-data.

Note: After you have run the script one time in a given Anaconda environment, you may reduce the script's execution time by adding a # in front of pip install pandas. For example, #pip install pandas instead of pip install pandas. The # will tell Python to skip the code without running it.

Directions: In the code below, replace Tennessee with the state of your choice. Note that the state name must be capitalized.

Directions: The code below will save the selected state's data in a file named NYTCovidData.csv. The file will be saved to whatever directory you have saved your Jupyter Notebook in. By default, each execution of this script will overwrite any already-existing NYTCovidData.csv in the directory. To prevent the overwrite, change NYTCovidData.csv to a different file name before running the script.

Note: The script will produce an error if the NYTCovidData.csv is open in an application at the time you run the script. To avoid the error, close the file or save it under a different file name.