Author: Ken Blake, Ph.D.

Description: This script will read the latest mobility data from Google's COVID-19 Community Mobility Reports page at https://www.google.com/covid19/mobility/, filter the data for a chosen county in a chosen state, print the most recent 60 days' worth of data for visits to four of the dataset's six types of destinations, and save the filtered data to a comma-separated value (.csv) file on your computer. The printed data can be copied and pasted directly into a spreadsheet for further analysis and visualization.

Note: For information about the data, including how to interpret the numbers this script prints out, see: https://www.google.com/covid19/mobility/data_documentation.html?hl=en.

Note: After you have run the script one time in an 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: Replace Tenessee and Rutherford County with the state and county name of your choice. The county name must include the word County, and the full name must be capitalized. For example, Rutherford County, not Rutherford or Rutherford county.

Directions: By default, the script will produce data for visits to retail and recreation venues, grocery and pharmacy stores, workplaces, and residential areas. To include data for visits to parks, delete "parks_percent_change_from_baseline", from the code below. To include data for visits to transit stations, delete "transit_stations_percent_change_from_baseline"], from the code below.

Directions: By default, the script will print data for the most recent available 60 days. To print a different number of days, change 60 to the number of your choice. Note that there is a lag of several days due to the time it takes Google to gather and process the data.

Directions: By default, the script will save the data for all available dates for the selected county in a comma-separated value file on your computer. The file will be saved in the same directory as the Jupyter Notebook you are using to run this script. Each iteration of the script will overwrite any existing version of the file. To avoid overwriting, you may change MobilityData.csv to the filename of your choice prior to each run of the script.