Changes

Jump to navigation Jump to search
*[[PostGIS Installation]]
*[[Urban Start-up Agglomeration]]
*[[Tiger Geocoder]]
=Notes=
The [https://www.census.gov/programs-surveys/acs/news/data-releases/2019/release-schedule.html ACS releases datasets ] in October September through December of the following year. It has the following datasets:*ACS5: 5-year estimates for a broad list of variables, from 2009-2020, covering 29,573 places.*ACS1: 1-year estimates from 2005-2020 for select variables for 630 places with populations of 65,000 people or 5 more*ACS1s: 1-year estimates. The five year estimates have supplements covering 2,323 places with 20,000 people or more information.*Some historical datasets (like ACS3), which are not currently supported
The 1 yr estimates are only available for places with populations of 65,000 people or more, the 1yr supplemental estimates cover down to places with 20,000 people or more, and the 5 yr estimates cover a whopping 29,573 places ACS provides information [https://www.census.gov/programs-surveys/acs/geography-acs/areas-published.html]on a broad range of geographies, including states, places, as compared with just 630 for the 1yr and 2,323 or the 1yr supplementszctas].
One can download the PUMS ==Other data for 2017 here: https://www2.census.gov/programs-surveys/acs/data/pums/2017/1-Year/ However, PUMS is only available for places in the [https://en.wikipedia.org/wiki/Public_Use_Microdata_Area Public Use Microdata Areas], which have a population 100,000 or more. sources==
And state-by-state, it looks possible to get the latest *PUMS data profiles (2013-for 2017 5 yr estimates) but not place by place as data, just as an aggregate:https://wwwwww2.census.gov/programs-surveys/acs/wwwdata/pums/data2017/data-tables1-Year/ *Population and-toolsother data are available from: http://census.ire.org/data-profiles/bulkdata.htmlNote: PUMS is only available for places in the [https://en.wikipedia.org/wiki/Public_Use_Microdata_Area Public Use Microdata Areas], which have a population 100,000 or more.
For just population, also see: http://census.ire.org/data/bulkdata.html=Using api. This seems to be based on the 2000 or 2010 census data only.gov=
=Using The new approach is to use api.census.gov=to request information. This applies to ACS and a broad range of other Census datasets.
The new approach is to use api.census.gov to request information. Each year has an API URL, which specifies the dataset and that takes '''get''' and '''for''' name-value pairs that specify variables and geographies, respectively. Generally, one can request geography, variable, and examples HTML pages on the same URL (rather than specifying the params). The ACS5 data goes back to 2009 and the ACS1 goes back to 2005 using the base URLfor ACS is: '''https://api.census.gov/data/yyyy/acs/acsx/''', where yyyy is year and x is 1 , 1s, 3 or 5.An example request is:*Requesting variable B06011_001E for ZCTAs from ACS5 for 2019: https://api.census.gov/data/2019/acs/acs5?get=NAME,B06011_001E&for=zip%20code%20tabulation%20area:
Pages listing available geographies, variables, and some examples are on the same base URL. For, example, for 2019, the URLs are:
*The 2019 ACS5 available geographies: https://api.census.gov/data/2019/acs/acs5/geography.html
*The 2019 ACS5 available variables: https://api.census.gov/data/2019/acs/acs5/variables.html
*Some example URLs for the API: https://api.census.gov/data/2019/acs/acs5/examples.html
*An example request: https://==get_ACS.py== A script called '''get_ACS.py''' automates the retrieval and compiling of results from api.census.gov/data/2019/acs/acs5?get=NAME. It has the year, geographic unit,and dataset in a (user-editable) parameters dictionary and is called with variables as command line parameters. Note that groups of variables are called in the same way as individual variables.  The script is available in: E:\projects\census\ Example commands are: python3 get_ACS.py B19013_001E B06009 B02001 python3 get_ACS.py B06011_001E& The script produces tab-delimited text files (to change to csv, edit line 63) with timestamped filenames.  Note: In the script, I rely on the response.json() method of request to handle the "JSON" produced by the API. I never use json.loads or similar. The Census doesn't adhere to any reasonable standards forencoding URLs or data! ==Examples and Documentation==zip%20code%20tabulation%20area:
Example API calls for median income, educational attainment, and race from the 5yr ACS, using the 2019 dataset:
==Working with the API==
===Getting a Key===
The API doesn't seem to require a key, but you can request one from https://api.census.gov/.
===Quoting, Nulls, and Error Codes===Every field is string quoted (even if it's a number) including error codes, except for nulls. The data contains "null" values, as well as values that indicate error codes (-999999999,-888888888,-666666666,-555555555,-222222222, and others. See https://www.census.gov/data/developers/data-sets/acs-1year/notes-on-acs-estimate-and-annotation-values.html. Generally, it appears that all negative and null values should can be striped.
===Improper Encoding===
The API uses improper URL encoding (or more accurately, doesn't use URL encoding), so most methods for auto-populating URL parameters in scripting languages will not function correctly. Build URLs manually.
The API returns improper JSON. Essentially, it just encodes a flat data structure into JSON -like syntax one line at a time, and completely ignores the structure of the data (and so much of the point of encoding it in JSON!). However, the first (zeroth) column is the requested geography name, so multiple pulls can be joined using that. And the first (zeroth) row is a valid set of column headers. Also, the nulls are valid JSON encodings. This, and the strong quoting, makes using a JSON handler likely worthwhile. An alternative is to strip the JSON tags and treat the data as a badly encoded CSV, which it is.
===Field and Group Names===To request a group ask for '''group(B06009)''' where you would normally request a field like '''B06011_001E'''. Programmers It looks like programmers can rely on groups and fields for estimates being identifiable from the "_" and the string length(\w{1}\d{5}\w{0,1}_\d{3}\w{1}), where the first letter is B or C and the last letter is E. Attributes for estimates can have two one last letter (like M for Margin) or two last letters(like AE - Annotation of Estimate and AM - Annotation of Margin). Note that requests of individual estimates don't provide the attributes but requests of groups do.
=Old Approach using AFF=

Navigation menu