Skip to content
Permalink
Browse files

Retrieved and included income data from ACS; corrected unit count totals

  • Loading branch information...
james-tyner committed Feb 19, 2019
1 parent 231509c commit 788eab7188cfe48fbc4cdbeabc573704459c9bd1
Showing with 40,941 additions and 9 deletions.
  1. BIN .DS_Store
  2. BIN 1031552_MasterZipCodes.pdf
  3. BIN 1031552_MasterZipCodes.xlsx
  4. +0 −4 analyze-data.py
  5. +60 −0 check-extremes.py
  6. 0 create-table.py → create-projects-table.py
  7. +52 −0 create-statistics-table.py
  8. +178 −0 extremes.txt
  9. +35 −0 factfinder-data/ACS_17_5YR_B01003.txt
  10. +5 −0 factfinder-data/ACS_17_5YR_B01003_metadata.csv
  11. +1,777 −0 factfinder-data/ACS_17_5YR_B01003_with_ann.csv
  12. +35 −0 factfinder-data/ACS_17_5YR_B02001.txt
  13. +23 −0 factfinder-data/ACS_17_5YR_B02001_metadata.csv
  14. +1,777 −0 factfinder-data/ACS_17_5YR_B02001_with_ann.csv
  15. +35 −0 factfinder-data/ACS_17_5YR_B25001.txt
  16. +5 −0 factfinder-data/ACS_17_5YR_B25001_metadata.csv
  17. +1,777 −0 factfinder-data/ACS_17_5YR_B25001_with_ann.csv
  18. +35 −0 factfinder-data/ACS_17_5YR_B25104.txt
  19. +37 −0 factfinder-data/ACS_17_5YR_B25104_metadata.csv
  20. +1,777 −0 factfinder-data/ACS_17_5YR_B25104_with_ann.csv
  21. +35 −0 factfinder-data/ACS_17_5YR_B25105.txt
  22. +5 −0 factfinder-data/ACS_17_5YR_B25105_metadata.csv
  23. +1,777 −0 factfinder-data/ACS_17_5YR_B25105_with_ann.csv
  24. +43 −0 factfinder-data/ACS_17_5YR_DP04.txt
  25. +575 −0 factfinder-data/ACS_17_5YR_DP04_metadata.csv
  26. +1,777 −0 factfinder-data/ACS_17_5YR_DP04_with_ann.csv
  27. +45 −0 factfinder-data/ACS_17_5YR_S0101.txt
  28. +459 −0 factfinder-data/ACS_17_5YR_S0101_metadata.csv
  29. +1,777 −0 factfinder-data/ACS_17_5YR_S0101_with_ann.csv
  30. +46 −0 factfinder-data/ACS_17_5YR_S0501.txt
  31. +1,373 −0 factfinder-data/ACS_17_5YR_S0501_metadata.csv
  32. +553 −0 factfinder-data/ACS_17_5YR_S0501_with_ann.csv
  33. +42 −0 factfinder-data/ACS_17_5YR_S0801.txt
  34. +345 −0 factfinder-data/ACS_17_5YR_S0801_metadata.csv
  35. +1,777 −0 factfinder-data/ACS_17_5YR_S0801_with_ann.csv
  36. +51 −0 factfinder-data/ACS_17_5YR_S0802.txt
  37. +811 −0 factfinder-data/ACS_17_5YR_S0802_metadata.csv
  38. +1,777 −0 factfinder-data/ACS_17_5YR_S0802_with_ann.csv
  39. +39 −0 factfinder-data/ACS_17_5YR_S1101.txt
  40. +203 −0 factfinder-data/ACS_17_5YR_S1101_metadata.csv
  41. +1,777 −0 factfinder-data/ACS_17_5YR_S1101_with_ann.csv
  42. +33 −0 factfinder-data/ACS_17_5YR_S1501.txt
  43. +771 −0 factfinder-data/ACS_17_5YR_S1501_metadata.csv
  44. +1,777 −0 factfinder-data/ACS_17_5YR_S1501_with_ann.csv
  45. +33 −0 factfinder-data/ACS_17_5YR_S1701.txt
  46. +369 −0 factfinder-data/ACS_17_5YR_S1701_metadata.csv
  47. +1,777 −0 factfinder-data/ACS_17_5YR_S1701_with_ann.csv
  48. +36 −0 factfinder-data/ACS_17_5YR_S1903.txt
  49. +243 −0 factfinder-data/ACS_17_5YR_S1903_metadata.csv
  50. +1,777 −0 factfinder-data/ACS_17_5YR_S1903_with_ann.csv
  51. +33 −0 factfinder-data/ACS_17_5YR_S2503.txt
  52. +555 −0 factfinder-data/ACS_17_5YR_S2503_metadata.csv
  53. +1,777 −0 factfinder-data/ACS_17_5YR_S2503_with_ann.csv
  54. +37 −0 factfinder-data/ACS_17_5YR_S2504.txt
  55. +459 −0 factfinder-data/ACS_17_5YR_S2504_metadata.csv
  56. +1,777 −0 factfinder-data/ACS_17_5YR_S2504_with_ann.csv
  57. +33 −0 factfinder-data/ACS_17_5YR_S2506.txt
  58. +263 −0 factfinder-data/ACS_17_5YR_S2506_metadata.csv
  59. +1,777 −0 factfinder-data/ACS_17_5YR_S2506_with_ann.csv
  60. +33 −0 factfinder-data/ACS_17_5YR_S2507.txt
  61. +235 −0 factfinder-data/ACS_17_5YR_S2507_metadata.csv
  62. +1,777 −0 factfinder-data/ACS_17_5YR_S2507_with_ann.csv
  63. +27 −0 factfinder-data/aff_download_readme_ann.txt
  64. +47 −0 get-counts-by-year.py
  65. +488 −0 la-county-master-zips.csv
  66. +1,776 −0 median-income-2017.csv
  67. +4 −5 obtain-data.py
  68. BIN permit_data.db
  69. +17 −0 tester.py
  70. +115 −0 zip-codes.txt
BIN +8 KB .DS_Store
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

@@ -0,0 +1,60 @@
import sqlite3

years = [
2013,
2014,
2015,
2016,
2017,
2018,
2019
]
# Future: add code to add the current year to the list if it's not already there

database = sqlite3.connect("permit_data.db")
cursor = database.cursor()

resultsFile = open("extremes.txt", "w")

for year in years:
resultsFile.write("----------------------------\n")
resultsFile.write("Year: " + str(year) + "\n\n")

# ZIP code with minimum
# command = """
# SELECT ZIP, MIN(%s)
# FROM statistics;
# """ % ("Units" + str(year))

command = """
SELECT ZIP, %s, MedIncome, Description
FROM statistics
WHERE %s = 0;
""" % ("Units" + str(year), "Units" + str(year))

cursor.execute(command)
resultsFile.write("ZIPs with zero units:\n")
for result in cursor:
resultsFile.write("ZIP " + str(result[0]) + ", " + str(result[3]) + " \n")
resultsFile.write("\t- Income: $" + str(result[2]) + "\n")
# resultsFile.write("\n")
# resultsFile.write("Min ZIP units: " + str(result[1]) + "\n\n")

# ZIP code with maximum
command = """
SELECT ZIP, MAX(%s), MedIncome, Description
FROM statistics;
""" % ("Units" + str(year))

cursor.execute(command)
resultsFile.write("\n")
for result in cursor:
resultsFile.write("Max: ZIP " + str(result[0]) + ", " + str(result[3]) + " \n")
resultsFile.write("\t- Income: $" + str(result[2]) + "\n")
resultsFile.write("Max ZIP units: " + str(result[1]) + "\n\n")

# checked data and found that maximums were never matched

database.commit()
database.close()
resultsFile.close()
File renamed without changes.
@@ -0,0 +1,52 @@
import sqlite3
import csv

connection = sqlite3.connect("permit_data.db")
cursor = connection.cursor()

# completely eliminate the table so you can recreate it
cursor.execute("DROP TABLE statistics;")

command = """
CREATE TABLE statistics (
ZIP int PRIMARY KEY,
UnitsAll int,
Units2019 int,
Units2018 int,
Units2017 int,
Units2016 int,
Units2015 int,
Units2014 int,
Units2013 int,
MedIncome int,
Description varchar(50));"""

cursor.execute(command)

ZIPfile = open("zip-codes.txt", "r")

IncomeFile = open("median-income-2017.csv", "r")
IncomeReader = csv.DictReader(IncomeFile, delimiter=",")
IncomeDict = {}

DescFile = open("la-county-master-zips.csv", "r")
DescReader = csv.DictReader(DescFile, delimiter=",")
DescDict = {}

for row in IncomeReader:
IncomeDict[row["zip-code"]] = row["income"]

for row in DescReader:
DescDict[row["\xef\xbb\xbfzip-code"]] = row["area"] # not sure why all the extra characters but there they are

for ZIP in ZIPfile:
Income = IncomeDict[ZIP.strip()]
Desc = DescDict[ZIP.strip()]
cursor.execute("INSERT INTO statistics (ZIP, MedIncome, Description) VALUES (%s, %s, '%s');" % (ZIP, Income, Desc))

IncomeFile.close()
DescFile.close()
ZIPfile.close()

connection.commit()
connection.close()
@@ -0,0 +1,178 @@
----------------------------
Year: 2013

ZIPs with zero units:
ZIP 90042, Highland Park (City of LA)
- Income: $55596
ZIP 90036, Park La Brea (City of LA)
- Income: $74279
ZIP 91605, North Hollywood
- Income: $43004
ZIP 91325, Northridge (City of LA)
- Income: $65129
ZIP 90025, Sawtelle (City of LA)/West Los Angeles (City of LA)
- Income: $78713
ZIP 91345, Mission Hills (City of LA)
- Income: $74193
ZIP 91324, Northridge (City of LA)
- Income: $68477
ZIP 91307, West Hills (City of LA)
- Income: $111043
ZIP 91402, Panorama City (City of LA)
- Income: $41669
ZIP 91311, Chatsworth (City of LA)
- Income: $82738
ZIP 91606, North Hollywood
- Income: $44773
ZIP 90026, Echo Park/Silverlake (City of LA)
- Income: $54342
ZIP 90043, Hyde Park (City of LA)/View Park/Windsor Hills
- Income: $41812
ZIP 91304, Canoga Park (City of LA)
- Income: $64367
ZIP 90041, Eagle Rock (City of LA)
- Income: $73250
ZIP 91331, Arleta (City of LA)/Pacoima (City of LA)
- Income: $57353
ZIP 90004, Hancock Park (City of LA)
- Income: $46581
ZIP 91411, Van Nuys (City of LA)
- Income: $50332
ZIP 90744, Wilmington (City of LA)
- Income: $43284
ZIP 90032, El Sereno (City of LA)/Monterey Hills (City of LA)
- Income: $47370
ZIP 90020, Hancock Park (City of LA)
- Income: $42407
ZIP 90501, Torrance
- Income: $64995
ZIP 90031, Montecito Heights (City of LA)
- Income: $41126
ZIP 91364, Woodland Hills (City of LA)
- Income: $100323
ZIP 91303, Canoga Park (City of LA)
- Income: $51486
ZIP 90732, Rancho Palos Verdes
- Income: $89440
ZIP 90005, Koreatown (City of LA)
- Income: $32461
ZIP 90292, Marina del Rey
- Income: $103948
ZIP 90717, Lomita/Rancho Palos Verdes
- Income: $61077

Max: ZIP 90015, Downtown Los Angeles (City of LA)
- Income: $32979
Max ZIP units: 348

----------------------------
Year: 2014

ZIPs with zero units:
ZIP 91307, West Hills (City of LA)
- Income: $111043
ZIP 91306, Winnetka (City of LA)
- Income: $64772
ZIP 91343, North Hills (City of LA)
- Income: $61692
ZIP 90020, Hancock Park (City of LA)
- Income: $42407
ZIP 90717, Lomita/Rancho Palos Verdes
- Income: $61077

Max: ZIP 90013, Downtown Los Angeles (City of LA)
- Income: $22808
Max ZIP units: 159

----------------------------
Year: 2015

ZIPs with zero units:
ZIP 90020, Hancock Park (City of LA)
- Income: $42407
ZIP 91504, Burbank (Glenoaks)
- Income: $73501
ZIP 90008, Baldwin Hills/Crenshaw (City of LA)/Leimert Park (City of LA)
- Income: $36641
ZIP 91340, San Fernando
- Income: $54703

Max: ZIP 90015, Downtown Los Angeles (City of LA)
- Income: $32979
Max ZIP units: 1526

----------------------------
Year: 2016

ZIPs with zero units:
ZIP 91345, Mission Hills (City of LA)
- Income: $74193
ZIP 91307, West Hills (City of LA)
- Income: $111043
ZIP 90063, City Terrace
- Income: $44121
ZIP 91205, Glendale (Tropico)
- Income: $38730
ZIP 90247, Gardena
- Income: $46076
ZIP 91214, La Crescenta
- Income: $94322

Max: ZIP 90094, Playa Vista
- Income: $136250
Max ZIP units: 1844

----------------------------
Year: 2017

ZIPs with zero units:
ZIP 91504, Burbank (Glenoaks)
- Income: $73501
ZIP 90017, Downtown Los Angeles (City of LA)
- Income: $28638

Max: ZIP 90015, Downtown Los Angeles (City of LA)
- Income: $32979
Max ZIP units: 1821

----------------------------
Year: 2018

ZIPs with zero units:
ZIP 91504, Burbank (Glenoaks)
- Income: $73501
ZIP 91505, Burbank
- Income: $82630

Max: ZIP 91601, North Hollywood (City of LA)
- Income: $50832
Max ZIP units: 937

----------------------------
Year: 2019

ZIPs with zero units:
ZIP 91307, West Hills (City of LA)
- Income: $111043
ZIP 90020, Hancock Park (City of LA)
- Income: $42407
ZIP 91335, Reseda (City of LA)
- Income: $55580
ZIP 90031, Montecito Heights (City of LA)
- Income: $41126
ZIP 90067, Century City (City of LA)
- Income: $123889
ZIP 90732, Rancho Palos Verdes
- Income: $89440
ZIP 90710, Harbor City (City of LA)
- Income: $57968
ZIP 91504, Burbank (Glenoaks)
- Income: $73501
ZIP 90057, Westlake (City of LA)
- Income: $31337
ZIP 90013, Downtown Los Angeles (City of LA)
- Income: $22808

Max: ZIP 90036, Park La Brea (City of LA)
- Income: $74279
Max ZIP units: 287
@@ -0,0 +1,35 @@
B01003
TOTAL POPULATION

Universe: Total population

Although the American Community Survey (ACS) produces population, demographic and housing unit estimates, it is the Census Bureau's Population Estimates Program that produces and disseminates the official estimates of the population for the nation, states, counties, cities, and towns and estimates of housing units for states and counties.


Supporting documentation on code lists, subject definitions, data accuracy, and statistical testing can be found on the American Community Survey website in the Technical Documentation section.

Sample size and data quality measures (including coverage rates, allocation rates, and response rates) can be found on the American Community Survey website in the Methodology section.


Source: U.S. Census Bureau, 2013-2017 American Community Survey 5-Year Estimates


Explanation of Symbols:An '**' entry in the margin of error column indicates that either no sample observations or too few sample observations were available to compute a standard error and thus the margin of error. A statistical test is not appropriate.
An '-' entry in the estimate column indicates that either no sample observations or too few sample observations were available to compute an estimate, or a ratio of medians cannot be calculated because one or both of the median estimates falls in the lowest interval or upper interval of an open-ended distribution.
An '-' following a median estimate means the median falls in the lowest interval of an open-ended distribution.
An '+' following a median estimate means the median falls in the upper interval of an open-ended distribution.
An '***' entry in the margin of error column indicates that the median falls in the lowest interval or upper interval of an open-ended distribution. A statistical test is not appropriate.
An '*****' entry in the margin of error column indicates that the estimate is controlled. A statistical test for sampling variability is not appropriate.
An 'N' entry in the estimate and margin of error columns indicates that data for this geographic area cannot be displayed because the number of sample cases is too small.
An '(X)' means that the estimate is not applicable or not available.


Data are based on a sample and are subject to sampling variability. The degree of uncertainty for an estimate arising from sampling variability is represented through the use of a margin of error. The value shown here is the 90 percent margin of error. The margin of error can be interpreted roughly as providing a 90 percent probability that the interval defined by the estimate minus the margin of error and the estimate plus the margin of error (the lower and upper confidence bounds) contains the true value. In addition to sampling variability, the ACS estimates are subject to nonsampling error (for a discussion of nonsampling variability, see Accuracy of the Data). The effect of nonsampling error is not represented in these tables.


While the 2013-2017 American Community Survey (ACS) data generally reflect the February 2013 Office of Management and Budget (OMB) definitions of metropolitan and micropolitan statistical areas; in certain instances the names, codes, and boundaries of the principal cities shown in ACS tables may differ from the OMB definitions due to differences in the effective dates of the geographic entities.


Estimates of urban and rural populations, housing units, and characteristics reflect boundaries of urban areas defined based on Census 2010 data. As a result, data for urban and rural areas from the ACS do not necessarily reflect the results of ongoing urbanization.


@@ -0,0 +1,5 @@
GEO.id,Id
GEO.id2,Id2
GEO.display-label,Geography
HD01_VD01,Estimate; Total
HD02_VD01,Margin of Error; Total

0 comments on commit 788eab7

Please sign in to comment.
You can’t perform that action at this time.