Skip to content

Python functions for working with USA ZIP Codes in geospatial processes, including ZCTA crosswalking transformations.

License

Notifications You must be signed in to change notification settings

cooperjaXC/zip-codes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZIP-Code Converters

Python functions for using USA ZIP Codes in geospatial processes.

Code style: black

By J. A. Cooper -- https://github.com/cooperjaXC

Overview

Crosswalks for easy python conversions of USA ZIP Codes.

  1. ZIP Codes → ZCTAs
  1. ZIP Codes → ZCTAs
  • Input
    • ZCTAs (string)
  • Outputs:
    • Each corresponding 5 digit postal Zip Codes (list)

Operates with both individual ZIP Codes and pandas dataframes. Compatible with both US Census year 2010 and 2020 (default) ZCTAs.

Key Functions

  • zip_code_crosswalk - Takes a (1) postal ZIP Code and transforms it into a Zip Code Tract Area (ZCTAs), the US Census-defined polygonal region for a ZIP Code. Compatible with both 2010 and 2020 ZCTAs.
  • df_zip_crosswalk - Takes a Pandas Dataframe with a ZIP-Code field and returns a ZCTA field using the crosswalk function.
  • reverse_zcta_crosswalk - Takes a (1) Zip Code Tract Area (ZCTAs) and returns all its associated postal ZIP Codes. Compatible with both 2010 and 2020 ZCTAs.
  • df_reverse_zcta_crosswalk - Takes a Pandas Dataframe with a ZCTA field and returns a field with a list of associated ZIP-Codes. Uses the reverse crosswalk function.
  • lat_lon_centroid - Takes a (1) postal ZIP Code and returns its ZCTA's spatial coordinates in a [latitude, longitude] format based on US Census TIGER shapefiles. Compatible with both 2010 and 2020 ZCTAs.
  • df_latlon_centroids - Takes a Pandas Dataframe with a ZIP-Code field and returns fields with the ZCTA's central latitude and longitude coordinates using the centroid function.

About

Python functions for working with USA ZIP Codes in geospatial processes, including ZCTA crosswalking transformations.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages