Write your topic title as a question. This helps with search. Provide as much context as possible.
Niki_Kaz
(Niki Kazahaya)
November 4, 2021, 1:20pm
#2
Hi @serwatkathomas ! If you’re using the Open Census Data from SafeGraph, that data is all at the Census Block Group (CBG) level, not ZIP level. However, a few Community members have previously circulated some useful Python code and tutorials to cross reference most CBG to ZCTA to Zip code conversion. Check out this notebook:
Here’s another one that might be helpful:
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Matching CBGs to ZCTAs for COVID-19 research"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The code below matches CBGs to ZCTAs in a many-to-one fashion using CBG centroids: \n",
"\n",
" A CBG is assigned to a ZCTA if that CBG's centroid is within the ZCTA's polygon.\n",
"\n",
"This strategy is not perfect but it does allow fast matching of CBG data to ZCTA level COVID-19 data. Below, ZIP code and ZCTA are used interchangeably for simplicity but ZCTAs are <i>always</i> the areal unit of analysis, except for NYC which combines ZCTAs in their COVID-19 reporting. Notably, this strategy will work for any type of polygon, thus NYC's unique data reporting can be easily accommodated.\n",
"\n",
"<b>Requirements:</b>\n",
This file has been truncated. show original