NYCPlanning / db-safegraph

SafeGraph ETL
4 stars 1 forks source link

ZCTA to Census Tract cross walk #72

Open SPTKL opened 3 years ago

SPTKL commented 3 years ago

71

This notebook below will create the census tract - zipcode tabulation area cross walk needed for generating the zcta level origin destination social distancing metrics table. more info available on the census website: https://www.census.gov/geographies/reference-files/time-series/geo/relationship-files.html#par_textimage_674173622 zcta_tract.ipynb.zip

SPTKL commented 3 years ago
import pandas as pd
df = pd.read_csv('https://www2.census.gov/geo/docs/maps-data/data/rel/zcta_tract_rel_10.txt', dtype=str)
zcta_tract = df.loc[df.GEOID.str[:5].isin(['36085','36081','36061','36047','36005']), ['ZCTA5', 'GEOID']]
zcta_tract.to_csv('zcta_tract.csv', index=False)