Exemplo n.º 1
0
import sys
sys.path.append("../../../tools/parsers")
from nhgis2pytable import convert

## SORT by shp index

if __name__ == '__main__':
    #map new fields to fields in NHGIS csv

    var_mapping = {
        "total_transpo": "JM0E001",
        "drove_alone": "JM0E003",
        "ferryboat": "JM0E015",
        "motorbike": "JM0E017",
        "bicycle": "JM0E018"  # why so many 119s ? 
        ,
        "walked": "JM0E019",
        "total_mobility": "JMLE001",
        "diffMSA_mobility": "JMLE007",
        "total_schooling": "JN9E001",
        "MA_schooling": "JN9E033",
        "selfemp_total": "JO7E001",
        "selfemp": "JO7E002"
    }

    # raw csv
    raw = "/Users/slow/workspace/choropleth-maps/data/census_raw_tables/usa_blockgroups/boris_top_6.csv"
    #convert(new,raw)
    # TODO: convert(transpo_mapping,raw, geoids=blkgrp_geoids)
    convert(var_mapping, raw, "transpo_mobility_schooling")
Exemplo n.º 2
0
from nhgis2pytable import convert

## SORT by shp index
"""
    Table 2:     Race
    Universe:    Total population
    Source code: B02001
    NHGIS code:  JMB
        JMBE001:     Total
        JMBE002:     White alone
        JMBE003:     Black or African American alone
        JMBE004:     American Indian and Alaska Native alone
        JMBE005:     Asian alone
        JMBE006:     Native Hawaiian and Other Pacific Islander alone
        JMBE007:     Some other race alone
        JMBE008:     Two or more races
        JMBE009:     Two or more races: Two races including Some other race
        JMBE010:     Two or more races: Two races excluding Some other race, and three or more races

"""
#TypeError: invalid type (<type 'str'>) for column ``total_mobility_pop``

if __name__ == '__main__':
    #map new fields to fields in NHGIS csv

    var_mapping = {"total": "JMBE001", "mixrace": "JMBE008"}

    raw = "raw.csv"
    # TODO: convert(transpo_mapping,raw,outfilename, geoids=blkgrp_geoids)
    convert(var_mapping, raw, "mixrace")
Exemplo n.º 3
0
import csv
import pysal
from tables import *
import sys
sys.path.append("../../../../tools/parsers")
from nhgis2pytable import convert

## SORT by shp index
"""
    Universe:    Population 1 year and over living in a Metropolitan Statistical Area in the United States
        JMLE001:     Total
        JMLE002:     Same house 1 year ago
        JMLE007:     Different house in United States 1 year ago: Different Metropolitan Statistical Area
        JMLE012:     Abroad 1 year ago
"""
#TypeError: invalid type (<type 'str'>) for column ``total_mobility_pop``

if __name__ == '__main__':
    #map new fields to fields in NHGIS csv

    var_mapping = {
        "total_mobility_pop": "JMLE001",
        "same_house_last_year": "JMLE002",
        "diff_usamsa_last_year": "JMLE007",
        "abroad_last_year": "JMLE012"
    }

    raw = "raw.csv"
    # TODO: convert(transpo_mapping,raw,outfilename, geoids=blkgrp_geoids)
    convert(var_mapping, raw, "mobility")
Exemplo n.º 4
0
        QTME003:     Family households: Married-couple family
        QTME004:     Family households: Other family
        QTME005:     Family households: Other family: Male householder, no wife present
        QTME006:     Family households: Other family: Female householder, no husband present
        QTME007:     Nonfamily households
        QTME008:     Nonfamily households: Householder living alone
        QTME009:     Nonfamily households: Householder not living alone
"""
import csv
import pysal
from tables import *
import sys
sys.path.append("../../../../tools/parsers")
from nhgis2pytable import convert



if __name__ == '__main__':
    #map new fields to fields in NHGIS csv

    var_mapping={
        "total":  "QTME001"
        ,"married":  "QTME003"
        ,"single_dad":  "QTME005"
        ,"single_mom":  "QTME006"
        ,"living_alone":  "QTME008"
        }

    raw="/Users/slow/workspace/geoscore/S3/attributes/usa_blockgroups/household_type/household_type.csv"
    convert(var_mapping,raw,"household_type")
Exemplo n.º 5
0
from tables import *
import sys
sys.path.append("../../../../tools/parsers")
from nhgis2pytable import convert

## SORT by shp index
"""
QYIE001:     Total
QYIE002:     For rent
QYIE003:     Rented, not occupied
QYIE004:     For sale only
QYIE005:     Sold, not occupied
QYIE006:     For seasonal, recreational, or occasional use
QYIE007:     For migrant workers
QYIE008:     Other vacant

"""
#TypeError: invalid type (<type 'str'>) for column ``total_mobility_pop``

if __name__ == '__main__':
    #map new fields to fields in NHGIS csv

    var_mapping = {
        "total": "QYIE001",
        "forsale": "QYIE004",
        "vacant": "QYIE008"
    }

    raw = "/Users/slow/workspace/geoscore/S3/attributes/usa_blockgroups/forsale_vacant/forsale_vacant.csv"
    convert(var_mapping, raw, "forsale_vacant")
Exemplo n.º 6
0
"""NHGIS attribute values convert to a pyTable 
"""
import csv
import pysal
from tables import *
import sys
sys.path.append("../../../../tools/parsers")
from nhgis2pytable import convert

## SORT by shp index

#TypeError: invalid type (<type 'str'>) for column ``total_mobility_pop``

if __name__ == '__main__':
    #map new fields to fields in NHGIS csv

    var_mapping = {"total_military": "QXIE001"}

    raw = "/Users/slow/workspace/geoscore/S3/attributes/usa_blockgroups/military/military.csv"
    convert(var_mapping, raw, "military")
Exemplo n.º 7
0
        ,
        "Female35to39": "QSEE037"  #     Female: 35 to 39 years
        ,
        "Female40to44": "QSEE038"  #     Female: 40 to 44 years
        ,
        "Female45to49": "QSEE039"  #     Female: 45 to 49 years
        ,
        "Female50to54": "QSEE040"  #     Female: 50 to 54 years
        ,
        "Female55to59": "QSEE041"  #     Female: 55 to 59 years
        ,
        "Female60and61": "QSEE042"  #     Female: 60 and 61 years
        ,
        "Female62to64": "QSEE043"  #     Female: 62 to 64 years
        ,
        "Female65and66": "QSEE044"  #     Female: 65 and 66 years
        ,
        "Female67to69": "QSEE045"  #     Female: 67 to 69 years
        ,
        "Female70to74": "QSEE046"  #     Female: 70 to 74 years
        ,
        "Female75to79": "QSEE047"  #     Female: 75 to 79 years
        ,
        "Female80to84": "QSEE048"  #     Female: 80 to 84 years
        ,
        "Female85over": "QSEE049"  #     Female: 85 years and over
    }

    raw = "/Users/slow/workspace/geoscore/S3/attributes/usa_blockgroups/age/age.csv"
    convert(var_mapping, raw, "age")