-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
42 lines (30 loc) · 1.67 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Warning: Still under construction.
Objective: Tools for making extraction of Census Bureau data easier
For example, to get income values by census tract which were estimated from the
Amercian Community Survey (ACS):
>>> import numpy
>>> import pyACS
>>> table = pyACS.ACS(pyACS.sumlevel.TRACT)
>>> len(table)
74002
>>> c = table['B19013001'] # Median Household Income
>>> c = numpy.nan_to_num(c)
>>> round(c.mean())
54404.0
>>> numpy.median(c)
49028.0
But first you need to download and install the census data....
$ mkdir /pyacs
$ cd /pyacs
$ wget "http://www2.census.gov/acs2011_5yr/summaryfile/2007-2011_ACSSF_All_In_2_Giant_Files(Experienced-Users-Only)/Tracts_Block_Groups_Only.tar.gz"
$ tar xfz Tracts_Block_Groups_Only.tar.gz
$ mv group2 SUMFILE
The downloaded file of attribute data is ~3gb "Tracts_Block_Groups_Only.zip" contains estimates for block groups and tracts only.
Now get the GEO files...
$ wget "http://www2.census.gov/acs2011_5yr/summaryfile/2007-2011_ACSSF_All_In_2_Giant_Files(Experienced-Users-Only)/2011_ACS_Geography_Files.zip"
$ unzip 2011_ACS_Geography_Files.zip
$ mv geog GEO
The downloaded GEO files contain the link between the `Logical Record Number` of the attribute data and the `geoid` of the shapefile/geometry data
See a description of the files in `$ ls /pyacs` here: https://github.com/schmidtc/ACS_Tools/wiki/_preview
See ACS ethnic codes here: http://www.census.gov/acs/www/Downloads/data_documentation/CodeLists/2011_ACS_Code_Lists.pdf
See ACS description of variables: http://www.census.gov/acs/www/Downloads/data_documentation/SubjectDefinitions/2011_ACSSubjectDefinitions.pdf