Wolfram Research

Census Tract Entity Store

Source Notebook

US Census tracts with location, polygon, and data from the American Community Survey

Details

Computed properties are included that directly access estimates from the ACS 2015-2019 5-Year Data Release via the US Census Bureau API.

(1 entity types, 72818 entities, 27058 properties)

Examples

Basic Examples (2) 

Retrieve the data:

In[1]:=
ResourceData[\!\(\*
TagBox["\"\<Census Tract Entity Store\>\"",
#& ,
BoxID -> "ResourceTag-Census Tract Entity Store-Input",
AutoDelete->True]\)]
Out[1]=

Register the EntityStore:

In[2]:=
EntityRegister[ResourceData[\!\(\*
TagBox["\"\<Census Tract Entity Store\>\"",
#& ,
BoxID -> "ResourceTag-Census Tract Entity Store-Input",
AutoDelete->True]\)]]
Out[2]=

Scope & Additional Elements (3) 

Show census tracts in Cook County, IL:

In[3]:=
GeoGraphics[{EdgeForm[Black], Polygon@EntityClass["CensusTract", "ADM2" -> Entity["AdministrativeDivision", {"CookCounty", "Illinois", "UnitedStates"}]]}]
Out[3]=

Find property classes matching a particular topic:

In[4]:=
Select[EntityValue["CensusTract", "PropertyClasses"], StringContainsQ[CommonName[#], "educational attainment"] &][[;; 5]]
Out[4]=

List all properties in a property class:

In[5]:=
EntityProperties[EntityPropertyClass["CensusTract", "B17003"]][[;; 5]]
Out[5]=

Visualizations (3) 

Generate a heat map of median household income in Cook County census tracts:

In[6]:=
GeoRegionValuePlot[
 EntityValue[
  EntityClass["CensusTract", "ADM2" -> Entity["AdministrativeDivision", {"CookCounty", "Illinois", "UnitedStates"}]], EntityProperty["CensusTract", "B19013_001E"],
   "Association"]]
Out[6]=

Generate a plot of population by race in a given US county’s census tracts (each point represents one person in a given race category, with points randomly distributed within each tract polygon):

In[7]:=
RacePointMap[usCounty_] := Block[{rawdata, randompoints, cols, leg}, rawdata = EntityValue[
EntityClass["CensusTract", "ADM2" -> usCounty], {
EntityProperty["CensusTract", "C02003_003E"], 
EntityProperty["CensusTract", "C02003_004E"], 
EntityProperty["CensusTract", "C02003_006E"], 
EntityProperty["CensusTract", "C02003_005E"], 
EntityProperty["CensusTract", "C02003_007E"], 
EntityProperty["CensusTract", "C02003_008E"], 
EntityProperty["CensusTract", "C02003_009E"], "Polygon"}]; Quiet[
   randompoints = Cases[rawdata, Pattern[x, 
Blank[]] :> {
RandomGeoPosition[
Part[x, -1], 
Part[x, 1]], 
RandomGeoPosition[
Part[x, -1], 
Part[x, 2]], 
RandomGeoPosition[
Part[x, -1], 
Part[x, 3]], 
RandomGeoPosition[
Part[x, -1], 
Total[
Part[x, 
Span[4, 6]]]], 
RandomGeoPosition[
Part[x, -1], 
Part[x, 7]]}]; Null]; cols = {
RGBColor[0.621866, 0.909026, 0.965408], 
RGBColor[0.909499, 0.582605, 0.44213], 
RGBColor[1, 1, 0.4], 
RGBColor[0.797253, 0.904982, 0.410498], 
RGBColor[0.645075, 0.644968, 0.978851]}; Quiet[
Legended[
GeoGraphics[{
Map[{
Opacity[0.25], 
PointSize[Small], 
Part[cols, 1], 
Point[
Part[#, 1]], 
Part[cols, 2], 
Point[
Part[#, 2]], 
Part[cols, 3], 
Point[
Part[#, 3]], 
Part[cols, 4], 
Point[
Part[#, 4]], 
Part[cols, 5], 
Point[
Part[#, 5]]}& , randompoints]}, GeoBackground -> "StreetMapNoLabels", ImageSize -> Full], 
SwatchLegend[
     cols, {"white", "black", "Asian", "other single race", "two or more races"}]]]]
In[8]:=
RacePointMap[
 Entity["AdministrativeDivision", {"AlleghenyCounty", "Pennsylvania", "UnitedStates"}]]
Out[8]=

Compare earnings for men and women in a single Census tract:

In[9]:=
CensusTractIncomeChart[ct_Entity] := Block[{male, female, bins, m, f}, male = Rest[
Sort[
Select[
EntityProperties[
EntityPropertyClass["CensusTract", "B20001"]], StringContainsQ[
CommonName[#], " male"]& ]]]; female = Rest[
Sort[
Select[
EntityProperties[
EntityPropertyClass["CensusTract", "B20001"]], StringContainsQ[
CommonName[#], "female"]& ]]]; bins = StringTrim[
Part[
StringSplit[
CommonName[male], " | "], All, 4], "]"]; m = EntityValue[
    ct, male]; f = EntityValue[ct, female]; Row[{
PairedBarChart[
     m, f, BarSpacing -> {Automatic, Automatic, 0.1}, PlotLabel -> Column[{
        "Sex by earnings for the population 16+ years", 
CommonName[ct]}], ChartLabels -> {{"male", "female"}, Automatic, bins}, ChartStyle -> {{LightBlue, LightOrange}, None, None}, ImageSize -> 400], 
GeoGraphics[{
EdgeForm[Black], Red, 
Polygon[ct]}, ImageSize -> {Automatic, 400}, GeoRangePadding -> Quantity[2, "Miles"]]}]]
In[10]:=
CensusTractIncomeChart[RandomEntity["CensusTract"]]
Out[10]=

Analysis (1) 

Show an income distribution across Dallas County census tracts:

In[11]:=
Histogram[
 EntityValue[
  EntityClass["CensusTract", "ADM2" -> Entity["AdministrativeDivision", {"DallasCounty", "Texas", "UnitedStates"}]], EntityProperty["CensusTract", "B19013_001E"]]]
Out[11]=

Wolfram Research, "Census Tract Entity Store" from the Wolfram Data Repository (2021) 

Data Resource History

Source Metadata

Publisher Information