Skip to content

daniellegauthier/Anthropocene-by-US-County

Repository files navigation

County Choropleth Map Generator

Description
This Python script generates choropleth maps of county-level data by state, allowing users to visualize various metrics across counties within a state while maintaining consistent color scaling across all states for easy comparison.

Requirements
Python 3.x
pandas
geopandas
matplotlib
requests

Data Files
meatpacking final.csv: Contains county-level data from Census 2019 (must be in the same directory as the script)
GeoJSON data is automatically fetched from: https://raw.githubusercontent.com/CodeForCary/CountyDataUSA5m/refs/heads/master/cb_2017_us_county_5m.json

Installation
Copy: !pip install pandas geopandas matplotlib requests

Usage
Ensure all required libraries are installed
Place the script in the same directory as meatpacking final.csv
Run the script
Follow the interactive prompts:

Choose to create a new map or exit
Enter the name of the state you want to visualize
Select the data column you want to map
View the generated map
Choose to create another map or exit

Features
Interactive menu-driven interface
Consistent color scaling across all state maps for easy comparison
Automatic county name standardization and matching
Detailed debug output for troubleshooting
Support for all 50 U.S. states
Ability to visualize any numeric column from the input data

Output
The script provides:
Interactive choropleth maps for chosen states and metrics
Debug information about county matching
Consistent color scales across different state maps
Options to create multiple maps in one session

Data Format
The input CSV file (meatpacking final.csv) should contain:
A county column with entries in the format: "County Name County, State"
Additional numeric columns that can be visualized on the map

Notes
County names are automatically standardized (removing "County" and handling case differences)
The color scale for each map uses the full range of the selected metric across all states
Counties with missing data are shown in light grey
The script provides detailed debugging output to help identify any county matching issues

Troubleshooting
If no data appears on the map:
Check the format of county names in your CSV
Review the debug output for mismatches between GeoJSON and CSV county names
Ensure the selected data column contains numeric values

About

Explore the US counties by education, internet use, and emissions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages