{"id":21172,"date":"2024-01-30T07:19:53","date_gmt":"2024-01-30T07:19:53","guid":{"rendered":"https:\/\/www.economicsobservatory.com\/test\/?post_type=question&#038;p=21172"},"modified":"2024-01-30T09:37:48","modified_gmt":"2024-01-30T09:37:48","slug":"data-read-acs","status":"publish","type":"question","link":"https:\/\/www.economicsobservatory.com\/test\/data-read-acs","title":{"rendered":"Mapping Income: Visualising ACS Data with Vega-Lite"},"content":{"rendered":"\n<p>This inaugural data-story explores using data from the American Community Survey (ACS), the US Census Bureau's annual demographics survey. It demonstrates accessing ACS data via the API, cleaning it, and visualising using Vega-lite. As a demonstration of the data's potential, we will work towards the creation of an interactive census-tract level (~4,000 people) map of incomes in, and around Chicago.<\/p>\n\n\n\n<p>This guide assumes familiarity with APIs and Python, but no prior knowledge of the ACS is needed. It is not intended as a beginner's tutorial for Vega-Lite. Partial code excerpts are provided throughout and the full, commented notebook is available at ***.<\/p>\n\n\n<section class=\"blocks__chart\">\n    <div id=\"chatEmbed71798\" class=\"blocks__chart-svg\"><\/div>\n\n    <script>\n        var spec = {\"$schema\":\"https:\\\/\\\/vega.github.io\\\/schema\\\/vega-lite\\\/v5.json\",\"data\":{\"url\":\"https:\\\/\\\/raw.githubusercontent.com\\\/jhellingsdata\\\/RADataHub\\\/main\\\/e4e\\\/ch3_Work\\\/data\\\/chart3_8_Chicago_counties_incomes.json\"},\"config\":{\"background\":\"#122B39\",\"font\":\"Circular Std\",\"title\":{\"color\":\"whitesmoke\",\"fontSize\":14,\"fontWeight\":400,\"subtitleColor\":\"#b4c8d8\"},\"mark\":{\"line\":{\"interpolate\":\"monotone\",\"color\":\"#36B7B4\"}},\"legend\":{\"labelColor\":\"#b4c8d8\"},\"view\":{\"stroke\":\"transparent\",\"width\":400,\"height\":300},\"range\":{\"category\":[\"#36B7B4\",\"#E6224B\",\"#F4C245\",\"#0063AF\",\"#00A767\",\"#179FDB\",\"#EB5C2E\"],\"diverging\":[\"#E6224B\",\"#E54753\",\"#C9C9C9\",\"#179FDB\",\"#122B39\"],\"heatmap\":[\"#C9C9C9\",\"#179FDB\",\"#0063AF\",\"#122B39\"],\"ordinal\":[\"#00A767\",\"#36B7B4\",\"#179FDB\",\"#0063AF\",\"#243B5A\"]},\"axisX\":{\"domainColor\":\"#b4c8d8\",\"domainOpacity\":0.5,\"grid\":false,\"labelAngle\":0,\"labelColor\":\"#b4c8d8\",\"labelOpacity\":0.7,\"orient\":\"bottom\",\"tickColor\":\"#b4c8d8\",\"tickCount\":10,\"tickOpacity\":0.5,\"title\":\"\",\"titleAlign\":\"center\",\"titleAnchor\":\"middle\",\"titleColor\":\"#b4c8d8\",\"titleFontSize\":12,\"titleOpacity\":0.8,\"titleY\":-15},\"axisY\":{\"domainColor\":\"#b4c8d8\",\"domainOpacity\":0.5,\"format\":\".0f\",\"gridColor\":\"#b4c8d8\",\"gridDash\":[1,5],\"gridOpacity\":0.5,\"labelColor\":\"#b4c8d8\",\"labelOpacity\":0.7,\"labelPadding\":5,\"tickColor\":\"#b4c8d8\",\"tickCount\":8,\"tickOpacity\":0.5,\"ticks\":false,\"titleX\":15,\"title\":\"FAO price index\",\"titleColor\":\"#b4c8d8\",\"titleFontSize\":12,\"titleOpacity\":0.8}},\"title\":{\"text\":\"Chicago Area Median Incomes\",\"subtitle\":[\"Real Income in Chicago and its Collar Counties,\",\" Workers Only, 2021 Prices, Source: US Census Bureau\",\" \"],\"fontSize\":16,\"subtitleFontSize\":12,\"anchor\":\"start\"},\"hconcat\":[{\"projection\":{\"type\":\"mercator\"},\"width\":200,\"height\":320,\"layer\":[{\"data\":{\"url\":\"https:\\\/\\\/raw.githubusercontent.com\\\/jhellingsdata\\\/RADataHub\\\/main\\\/e4e\\\/ch3_Work\\\/data\\\/chart3_8_Chicago_wards_incomes.json\"},\"transform\":[{\"filter\":{\"param\":\"index\"}},{\"lookup\":\"tract\",\"from\":{\"data\":{\"url\":\"https:\\\/\\\/raw.githubusercontent.com\\\/jhellingsdata\\\/RADataHub\\\/main\\\/e4e\\\/ch3_Work\\\/data\\\/chart3_8_chicago_tracts.topojson\",\"format\":{\"type\":\"topojson\",\"feature\":\"chicago_tracts\"}},\"key\":\"properties.TRACTCE\",\"fields\":[\"properties\",\"type\",\"geometry\"]}}],\"mark\":\"geoshape\",\"encoding\":{\"color\":{\"field\":\"Real Income\",\"scale\":{\"scheme\":\"yellowgreenblue\",\"domain\":[0,130000]},\"type\":\"quantitative\",\"legend\":{\"direction\":\"horizontal\",\"gradientLength\":200,\"format\":\"$s\",\"orient\":\"none\",\"title\":null,\"legendX\":0,\"legendY\":-35}},\"tooltip\":[{\"field\":\"County_Name\",\"type\":\"nominal\",\"title\":\"County\"},{\"field\":\"Real Income\",\"type\":\"nominal\",\"format\":\"$,.2f\",\"title\":\"Median Income\"},{\"field\":\"tract\",\"title\":\"Census Tract\"}]}},{\"transform\":[{\"filter\":\" indexof(['Cook', 'Dupage', 'Lake', 'Will', 'Mchenry', 'Kane' ],datum.properties.name)>-1 \"}],\"data\":{\"url\":\"https:\\\/\\\/raw.githubusercontent.com\\\/jhellingsdata\\\/RADataHub\\\/main\\\/e4e\\\/ch3_Work\\\/data\\\/illinois-counties.topojson\",\"format\":{\"type\":\"topojson\",\"feature\":\"illinois-counties\"}},\"mark\":{\"type\":\"geoshape\",\"fill\":null,\"stroke\":\"white\",\"strokeWidth\":0.5}},{\"transform\":[{\"filter\":\" indexof(['Cook', 'DuPage', 'Lake', 'Will', 'McHenry', 'Kane' ],datum.name)>-1 \"},{\"calculate\":\"datum.lat + {'Cook' : -0.08 , 'DuPage' : -0.03 , 'Lake' :0, 'Will' : 0, 'McHenry' : 0, 'Kane': 0}[datum.name] \",\"as\":\"lat\"},{\"calculate\":\"datum.lon + {'Cook' : -0.12 , 'DuPage' : 0 , 'Lake' : -0.38, 'Will' : 0, 'McHenry' : 0, 'Kane': 0}[datum.name] \",\"as\":\"lon\"}],\"data\":{\"url\":\"https:\\\/\\\/raw.githubusercontent.com\\\/jhellingsdata\\\/RADataHub\\\/main\\\/e4e\\\/ch3_Work\\\/data\\\/illinois_counties_centeroids.json\"},\"mark\":{\"type\":\"text\",\"fontWeight\":\"bold\",\"color\":\"white\",\"size\":14},\"encoding\":{\"text\":{\"field\":\"name\"},\"longitude\":{\"field\":\"lon\",\"type\":\"quantitative\"},\"latitude\":{\"field\":\"lat\",\"type\":\"quantitative\"}}}]},{\"width\":400,\"height\":320,\"layer\":[{\"params\":[{\"name\":\"index\",\"value\":[{\"x\":2012}],\"select\":{\"type\":\"point\",\"encodings\":[\"x\"],\"on\":\"mouseover\",\"nearest\":true}}],\"transform\":[{\"filter\":\"datum.Year > 2009 & datum.Year != 2015 & datum.Year<2021\"}],\"mark\":\"point\",\"encoding\":{\"x\":{\"field\":\"Year\"},\"opacity\":{\"value\":0}}},{\"mark\":{\"type\":\"line\",\"point\":true},\"encoding\":{\"x\":{\"field\":\"Year\",\"axis\":{\"labelAngle\":0,\"labelAlign\":\"center\",\"ticks\":false,\"labelPadding\":12}},\"y\":{\"field\":\"Real Income\",\"type\":\"quantitative\",\"axis\":{\"tickOpacity\":0,\"gridOpacity\":0.6},\"scale\":{\"zero\":false}},\"color\":{\"condition\":[{\"test\":\"datum['NAME'] == 'Cook County'\",\"value\":\"rgb(81,157,188)\"}],\"field\":\"NAME\",\"scale\":{\"range\":[\"rgb(200,200,200)\"]},\"legend\":null},\"opacity\":{\"value\":1}}},{\"transform\":[{\"filter\":{\"param\":\"index\"}}],\"encoding\":{\"x\":{\"field\":\"Year\"},\"color\":{\"value\":\"whitesmoke\"}},\"layer\":[{\"mark\":{\"type\":\"rule\",\"strokeWidth\":0.5}},{\"mark\":{\"type\":\"text\",\"align\":\"center\",\"fontWeight\":100},\"encoding\":{\"text\":{\"field\":\"Year\"},\"y\":{\"value\":-10}}}]},{\"transform\":[{\"filter\":\"datum.Year==2021\"}],\"encoding\":{\"x\":{\"field\":\"Year\",\"axis\":{\"title\":null}},\"y\":{\"field\":\"Real Income\",\"type\":\"quantitative\",\"scale\":{\"zero\":false},\"axis\":{\"title\":null,\"format\":\"$s\"}},\"color\":{\"condition\":[{\"test\":\"datum['NAME'] == 'Cook County'\",\"value\":\"rgb(81,157,188)\"}],\"field\":\"Region name\",\"scale\":{\"range\":[\"rgb(200,200,200)\"]},\"legend\":null},\"opacity\":{\"value\":1},\"text\":{\"field\":\"NAME\"}},\"mark\":{\"type\":\"text\",\"align\":\"left\",\"dx\":5}}]}],\"description\":\"A chart titled 'Chicago Area Median Incomes' with subtitle 'Median Individual Income, Workers Only   2021 Prices, source: Census  \"};\n        var view = new vega.View(vega.parse(spec), {\n            responsive: true,\n            renderer: \"canvas\", \/\/ renderer (canvas or svg)\n            container: \"#chatEmbed71798\", \/\/ parent DOM container\n            hover: true \/\/ enable hover processing\n        });\n        view.run();\n\n        vegaEmbed('#chatEmbed71798', spec);\n    <\/script>\n<\/section>\n\n\n<h2 class=\"wp-block-heading\">Using the ACS API<\/h2>\n\n\n\n<p>Before you can start using the ACS API, we need to obtain an API key. This is a straightforward process:<\/p>\n\n\n\n<ol>\n<li>Visit the API key sign-up page: <a href=\"https:\/\/api.census.gov\/data\/key_signup.html\">ACS API Key Sign-Up<\/a>.<\/li>\n\n\n\n<li>Fill in the required information. The process is quick, free, and easy - we received a key in just minutes.<\/li>\n\n\n\n<li>Once you have your key, keep it secret.<\/li>\n<\/ol>\n\n\n\n<p>The next step is to find identifying information (a series id, and codes for geography) for the data required. Conveniently, the Census Bureau hosts large tables of variables where it lists all series available. For example, the 2022 5 Year Edition's  variables are available <a href=\"https:\/\/www.census.gov\/data\/developers\/data-sets\/acs-5year.html\">here<\/a> (Detailed Tables).<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"282\" src=\"https:\/\/www.economicsobservatory.com\/test\/wp-content\/uploads\/2024\/01\/image-2-1024x282.png\" alt=\"\" class=\"wp-image-21187\" srcset=\"https:\/\/www.economicsobservatory.com\/test\/wp-content\/uploads\/2024\/01\/image-2-1024x282.png 1024w, https:\/\/www.economicsobservatory.com\/test\/wp-content\/uploads\/2024\/01\/image-2-300x83.png 300w, https:\/\/www.economicsobservatory.com\/test\/wp-content\/uploads\/2024\/01\/image-2-768x211.png 768w, https:\/\/www.economicsobservatory.com\/test\/wp-content\/uploads\/2024\/01\/image-2-1536x423.png 1536w, https:\/\/www.economicsobservatory.com\/test\/wp-content\/uploads\/2024\/01\/image-2-2048x564.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Searching the <a href=\"https:\/\/api.census.gov\/data\/2022\/acs\/acs5\/variables.html\">variable table<\/a> for 'Median Income', we find series \"B21004_001E\" containing the annual median income for all earners. The series title refers to veteran status and sex but as we're not concerned about breaking down-our data further, we just choose the series ending 'Total:'; if instead, we wanted to present the incomes of veterans only, we could choose the next series, ending \"Veteran\".<\/p>\n\n\n\n<p>As well as the series, we have to specify the geography for which we want results. A full list of supported geography is <a href=\"https:\/\/api.census.gov\/data\/2022\/acs\/acs5\/geography.html\">available<\/a> on the ACS website. For our purposes, we want granular data for our map for which we'll use Census tracts, as well as county-level data. Across the US, there are over 70,000 Census tracts so we'll also have to specify that we only want data from Illinois (which we can <a href=\"https:\/\/en.wikipedia.org\/wiki\/Federal_Information_Processing_Standard_state_code\">find<\/a> has code 17).<\/p>\n\n\n\n<p>Having identified the series and geography we desire, we can put together API calls to request the data. ACS API urls take the form:<\/p>\n\n\n\n<p class=\"has-text-align-center\"><a href=\"https:\/\/api.census.gov\/data\/{year}\/{dataset}?get=NAME,{series}&for=tract:*&in=state:{state}&in=county:*&key={api_key}\">https:\/\/api.census.gov\/data\/{year}\/{dataset}?get=NAME,{series}&for=tract:*&in=state:17&in=county:*&key={api_key}<\/a><\/p>\n\n\n\n<p>where we specify:<\/p>\n\n\n\n<ul>\n<li><strong>The Year<\/strong>: Corresponding to an ACS release. Some years, notably 2020, are unavailable.<\/li>\n\n\n\n<li><strong>The Dataset: <\/strong>This will always be acs\/acs5 or acs\/acs3.<\/li>\n\n\n\n<li><strong>The Series: <\/strong>The id of the data we identified above.<\/li>\n\n\n\n<li><strong>The Geography: <\/strong>We've specified that we're looking for all the tracts in every county in the state with the code 17 (Illinois).<\/li>\n<\/ul>\n\n\n\n<p>Putting this all together, to request all the available Median Income data (\"B21004_001E\") at the census-tract level, we can loop through the years we require and store the responses in a list:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/FM-ds\/5b7cdc6efb88f25c4b2b17f4ae2e8f4d.js\"><\/script>\n\n\n\n<p>For data at the county-level, the process is the same, except we specify that we're looking for all counties within Illinois (\"&for=county:*&in=state:17\").<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Cleaning ACS Data<\/h2>\n\n\n\n<p>We now have a list of data-frames each containing a year of ACS data. The next step is simple; we just have to merge and clean all the data. As we're just interested in the area in, and around, Chicago, the code below filters for just tracts in a few counties but this is a completely optional step.<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/FM-ds\/2498ee56dca715f7db632cae35dc3b4b.js\"><\/script>\n\n\n\n<p>The ACS returns nominal data so if instead we want real, inflation adjusted, incomes, we have to deflate the figures ourselves. Luckily, a Python module, <a href=\"https:\/\/pypi.org\/project\/easymoney\/\">EasyMoney<\/a>, makes currency conversions and inflation adjustment easy. Using the function \"ep.normalize\" and specifying a year and currency, we can add a new column for 'Real Incomes'. Again, this is completely optional.<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/FM-ds\/fe5b6ff50e0bdbd43e0e890438825961.js\"><\/script>\n\n\n\n<h2 class=\"wp-block-heading\">Visualising the Data<\/h2>\n\n\n\n<p>To map the income data we've extracted, we have to associate it with geographic data. The US census bureau offers shape files for every state (<a href=\"https:\/\/www.census.gov\/geographies\/mapping-files\/time-series\/geo\/carto-boundary-file.html\">here<\/a>) which can be converted to the .geoJson or .topoJson formats used online with tools like <a href=\"http:\/\/mapshaper.org\">MapShaper<\/a> (online), or <a href=\"http:\/\/QGIS.org\">QGis<\/a> (free download).<\/p>\n\n\n\n<p>Using Vega-lite, we can produce a simple cross-section with just a few lines of code. More complete guides <a href=\"https:\/\/medium.com\/@traffordDataLab\/lets-make-a-map-in-vega-lite-75c24428275\">exist<\/a> but the basics are simple. We have to first upload our fetched data somewhere and associate the ACS data with the map data using a transform in Vega-lite.<\/p>\n\n\n<section class=\"blocks__chart\">\n    <div id=\"chatEmbed938428\" class=\"blocks__chart-svg\"><\/div>\n\n    <script>\n        var spec = {\"title\":{\"text\":\"Median Incomes in Chicago\",\"subtitle\":[\"2021, American Community Survey\",\"\"],\"anchor\":\"start\"},\"$schema\":\"https:\\\/\\\/vega.github.io\\\/schema\\\/vega-lite\\\/v5.json\",\"width\":250,\"height\":300,\"data\":{\"url\":\"https:\\\/\\\/raw.githubusercontent.com\\\/jhellingsdata\\\/RADataHub\\\/main\\\/e4e\\\/ch3_Work\\\/data\\\/chart3_8_Chicago_wards_incomes.json\"},\"transform\":[{\"lookup\":\"tract\",\"from\":{\"data\":{\"url\":\"https:\\\/\\\/raw.githubusercontent.com\\\/jhellingsdata\\\/RADataHub\\\/main\\\/e4e\\\/ch3_Work\\\/data\\\/chart3_8_chicago_tracts.topojson\",\"format\":{\"type\":\"topojson\",\"feature\":\"chicago_tracts\"}},\"key\":\"properties.TRACTCE\",\"fields\":[\"properties\",\"type\",\"geometry\"]}}],\"projection\":{\"type\":\"albersUsa\"},\"mark\":\"geoshape\",\"encoding\":{\"color\":{\"field\":\"Real Income\",\"legend\":{\"format\":\"$.0s\"},\"type\":\"quantitative\"}}};\n        var view = new vega.View(vega.parse(spec), {\n            responsive: true,\n            renderer: \"canvas\", \/\/ renderer (canvas or svg)\n            container: \"#chatEmbed938428\", \/\/ parent DOM container\n            hover: true \/\/ enable hover processing\n        });\n        view.run();\n\n        vegaEmbed('#chatEmbed938428', spec);\n    <\/script>\n<\/section>\n\n\n<p>  To visualise our data, we just link to our income data:<\/p>\n\n\n\n<pre class=\"wp-block-code has-cyan-bluish-gray-background-color has-background has-small-font-size\"><code>  \"data\": {\n    \"url\": \"https:\/\/raw.githubusercontent.com\/jhellingsdata\/RADataHub\/main\/e4e\/ch3_Work\/data\/chart3_8_Chicago_wards_incomes.json\"\n  },<\/code><\/pre>\n\n\n\n<p>associate it with the geographic regions, by linking the shapes of census tracts with incomes by their ID:<\/p>\n\n\n\n<pre class=\"wp-block-code has-cyan-bluish-gray-background-color has-background has-small-font-size\"><code>  \"transform\": [            {\n              \"lookup\": \"tract\",\n              \"from\": {\n                \"data\": {\n                  \"url\": \"https:\/\/raw.githubusercontent.com\/jhellingsdata\/RADataHub\/main\/e4e\/ch3_Work\/data\/chart3_8_chicago_tracts.topojson\",\n                  \"format\": {\"type\": \"topojson\", \"feature\": \"chicago_tracts\"}\n                },\n                \"key\": \"properties.TRACTCE\",\n                \"fields\": [\"properties\", \"type\", \"geometry\"]\n              }\n            }\n],\n<\/code><\/pre>\n\n\n\n<p>and specify a \"geoshape\" mark whose colour is defined by the income:<\/p>\n\n\n\n<pre class=\"wp-block-code has-cyan-bluish-gray-background-color has-background has-small-font-size\"><code>  \"mark\": \"geoshape\",\n  \"encoding\": {\n    \"color\": {\n      \"field\": \"Real Income\",\n      \"legend\": {\"format\": \"$.0s\"},\n      \"type\": \"quantitative\"\n    }\n  }\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Adding Interactivity<\/h4>\n\n\n<section class=\"blocks__chart\">\n    <div id=\"chatEmbed839885\" class=\"blocks__chart-svg\"><\/div>\n\n    <script>\n        var spec = {\"title\":{\"text\":\"Median Incomes in Chicago and its Collar Counties\",\"subtitle\":[\"2021 USD, American Community Survey\",\"\"],\"anchor\":\"start\"},\"$schema\":\"https:\\\/\\\/vega.github.io\\\/schema\\\/vega-lite\\\/v5.json\",\"width\":250,\"height\":300,\"data\":{\"url\":\"https:\\\/\\\/raw.githubusercontent.com\\\/jhellingsdata\\\/RADataHub\\\/main\\\/e4e\\\/ch3_Work\\\/data\\\/chart3_8_Chicago_wards_incomes.json\"},\"params\":[{\"name\":\"year_select\",\"value\":[2019],\"bind\":{\"input\":\"range\",\"min\":2010,\"max\":2021,\"step\":1,\"name\":\"Select year:\"}}],\"transform\":[{\"filter\":\"datum.Year==year_select\"},{\"lookup\":\"tract\",\"from\":{\"data\":{\"url\":\"https:\\\/\\\/raw.githubusercontent.com\\\/jhellingsdata\\\/RADataHub\\\/main\\\/e4e\\\/ch3_Work\\\/data\\\/chart3_8_chicago_tracts.topojson\",\"format\":{\"type\":\"topojson\",\"feature\":\"chicago_tracts\"}},\"key\":\"properties.TRACTCE\",\"fields\":[\"properties\",\"type\",\"geometry\"]}}],\"projection\":{\"type\":\"albersUsa\"},\"mark\":\"geoshape\",\"encoding\":{\"color\":{\"field\":\"Real Income\",\"legend\":{\"format\":\"$.0s\"},\"type\":\"quantitative\"}}};\n        var view = new vega.View(vega.parse(spec), {\n            responsive: true,\n            renderer: \"canvas\", \/\/ renderer (canvas or svg)\n            container: \"#chatEmbed839885\", \/\/ parent DOM container\n            hover: true \/\/ enable hover processing\n        });\n        view.run();\n\n        vegaEmbed('#chatEmbed839885', spec);\n    <\/script>\n<\/section>\n\n\n<p>From this simple base, much more is possible. For example, by introducing an <a href=\"https:\/\/vega.github.io\/vega-lite\/docs\/parameter.html#:~:text=Parameters%20are%20the%20basic%20building,and%20drags)%20to%20data%20queries.\">interactive parameter<\/a>, we can filter the Choropleth map to a user-chosen year. This requires just two modifications to the simple example above. First, we must define a parameter to store the year selection.<\/p>\n\n\n\n<pre class=\"wp-block-code has-cyan-bluish-gray-background-color has-background has-small-font-size\"><code>  \"params\": [\n    {\n      \"name\": \"year_select\",\n      \"value\": [2019],\n      \"bind\": {\n        \"input\": \"range\",\n        \"min\": 2010,\n        \"max\": 2021,\n        \"step\": 1,\n        \"name\": \"Select year:\"\n      }\n    }\n  ],\n<\/code><\/pre>\n\n\n\n<p>Second, we simply apply a filter transform to filter the data to only the year chosen by the user.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"featured_media":0,"template":"","categories":[],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Mapping Income: Visualising ACS Data with Vega-Lite - Economics Observatory<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.economicsobservatory.com\/test\/data-read-acs\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Mapping Income: Visualising ACS Data with Vega-Lite - Economics Observatory\" \/>\n<meta property=\"og:description\" content=\"This inaugural data-story explores using data from the American Community Survey (ACS), the US Census Bureau&#039;s annual demographics survey. It demonstrates accessing ACS data via the API, cleaning it, and visualising using Vega-lite. As a demonstration of the data&#039;s potential, we will work towards the creation of an interactive census-tract level (~4,000 people) map of [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.economicsobservatory.com\/test\/data-read-acs\" \/>\n<meta property=\"og:site_name\" content=\"Economics Observatory\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-30T09:37:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.economicsobservatory.com\/test\/wp-content\/uploads\/2024\/01\/image-2-1024x282.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@econobservatory\" \/>\n<meta name=\"twitter:label1\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.economicsobservatory.com\/test\/data-read-acs\",\"url\":\"https:\/\/www.economicsobservatory.com\/test\/data-read-acs\",\"name\":\"Mapping Income: Visualising ACS Data with Vega-Lite - Economics Observatory\",\"isPartOf\":{\"@id\":\"https:\/\/www.economicsobservatory.com\/test\/#website\"},\"datePublished\":\"2024-01-30T07:19:53+00:00\",\"dateModified\":\"2024-01-30T09:37:48+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.economicsobservatory.com\/test\/data-read-acs#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.economicsobservatory.com\/test\/data-read-acs\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.economicsobservatory.com\/test\/data-read-acs#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.economicsobservatory.com\/test\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Mapping Income: Visualising ACS Data with Vega-Lite\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.economicsobservatory.com\/test\/#website\",\"url\":\"https:\/\/www.economicsobservatory.com\/test\/\",\"name\":\"Economics Observatory\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.economicsobservatory.com\/test\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.economicsobservatory.com\/test\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.economicsobservatory.com\/test\/#organization\",\"name\":\"Economics Observatory\",\"url\":\"https:\/\/www.economicsobservatory.com\/test\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.economicsobservatory.com\/test\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.economicsobservatory.com\/wp-content\/uploads\/2021\/06\/Logo-for-Twitter.png\",\"contentUrl\":\"https:\/\/www.economicsobservatory.com\/wp-content\/uploads\/2021\/06\/Logo-for-Twitter.png\",\"width\":540,\"height\":392,\"caption\":\"Economics Observatory\"},\"image\":{\"@id\":\"https:\/\/www.economicsobservatory.com\/test\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/twitter.com\/econobservatory\",\"https:\/\/www.linkedin.com\/company\/economics-observatory\/\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Mapping Income: Visualising ACS Data with Vega-Lite - Economics Observatory","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.economicsobservatory.com\/test\/data-read-acs","og_locale":"en_GB","og_type":"article","og_title":"Mapping Income: Visualising ACS Data with Vega-Lite - Economics Observatory","og_description":"This inaugural data-story explores using data from the American Community Survey (ACS), the US Census Bureau's annual demographics survey. It demonstrates accessing ACS data via the API, cleaning it, and visualising using Vega-lite. As a demonstration of the data's potential, we will work towards the creation of an interactive census-tract level (~4,000 people) map of [&hellip;]","og_url":"https:\/\/www.economicsobservatory.com\/test\/data-read-acs","og_site_name":"Economics Observatory","article_modified_time":"2024-01-30T09:37:48+00:00","og_image":[{"url":"https:\/\/www.economicsobservatory.com\/test\/wp-content\/uploads\/2024\/01\/image-2-1024x282.png"}],"twitter_card":"summary_large_image","twitter_site":"@econobservatory","twitter_misc":{"Estimated reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.economicsobservatory.com\/test\/data-read-acs","url":"https:\/\/www.economicsobservatory.com\/test\/data-read-acs","name":"Mapping Income: Visualising ACS Data with Vega-Lite - Economics Observatory","isPartOf":{"@id":"https:\/\/www.economicsobservatory.com\/test\/#website"},"datePublished":"2024-01-30T07:19:53+00:00","dateModified":"2024-01-30T09:37:48+00:00","breadcrumb":{"@id":"https:\/\/www.economicsobservatory.com\/test\/data-read-acs#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.economicsobservatory.com\/test\/data-read-acs"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.economicsobservatory.com\/test\/data-read-acs#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.economicsobservatory.com\/test\/"},{"@type":"ListItem","position":2,"name":"Mapping Income: Visualising ACS Data with Vega-Lite"}]},{"@type":"WebSite","@id":"https:\/\/www.economicsobservatory.com\/test\/#website","url":"https:\/\/www.economicsobservatory.com\/test\/","name":"Economics Observatory","description":"","publisher":{"@id":"https:\/\/www.economicsobservatory.com\/test\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.economicsobservatory.com\/test\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-GB"},{"@type":"Organization","@id":"https:\/\/www.economicsobservatory.com\/test\/#organization","name":"Economics Observatory","url":"https:\/\/www.economicsobservatory.com\/test\/","logo":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.economicsobservatory.com\/test\/#\/schema\/logo\/image\/","url":"https:\/\/www.economicsobservatory.com\/wp-content\/uploads\/2021\/06\/Logo-for-Twitter.png","contentUrl":"https:\/\/www.economicsobservatory.com\/wp-content\/uploads\/2021\/06\/Logo-for-Twitter.png","width":540,"height":392,"caption":"Economics Observatory"},"image":{"@id":"https:\/\/www.economicsobservatory.com\/test\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/twitter.com\/econobservatory","https:\/\/www.linkedin.com\/company\/economics-observatory\/"]}]}},"_links":{"self":[{"href":"https:\/\/www.economicsobservatory.com\/test\/wp-json\/wp\/v2\/question\/21172"}],"collection":[{"href":"https:\/\/www.economicsobservatory.com\/test\/wp-json\/wp\/v2\/question"}],"about":[{"href":"https:\/\/www.economicsobservatory.com\/test\/wp-json\/wp\/v2\/types\/question"}],"version-history":[{"count":30,"href":"https:\/\/www.economicsobservatory.com\/test\/wp-json\/wp\/v2\/question\/21172\/revisions"}],"predecessor-version":[{"id":21217,"href":"https:\/\/www.economicsobservatory.com\/test\/wp-json\/wp\/v2\/question\/21172\/revisions\/21217"}],"wp:attachment":[{"href":"https:\/\/www.economicsobservatory.com\/test\/wp-json\/wp\/v2\/media?parent=21172"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.economicsobservatory.com\/test\/wp-json\/wp\/v2\/categories?post=21172"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.economicsobservatory.com\/test\/wp-json\/wp\/v2\/tags?post=21172"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}