def __init__(self): self.query = queries( ) #query object has query texts for all database interactions as different functions self.parse = parse_inputs( ) #parses the LAR row into selected components and stores them in a dictionary self.connect = connect_DB( ) #sets a database connection and passes a cursor back self.orig_by_tract_minority_category = [ ] #sorted alphabetically: high, low, middle, upper self.app_by_tract_minority_category = [ ] #sorted alphabetically: high, low, middle, upper self.tract_orig_rates = [ ] #holds an alphabetically sorted list of origination rates for tract categorized by minority population #order of tract_orig_rates list: high, low, middle, upper self.nonminority_approval_rate = 0 #establishes a variable to hold rates for graphing self.HMDA_cols = [ 'statecode', 'countycode', 'censustractnumber', 'applicantrace1', 'applicantrace2', 'applicantrace3', 'applicantrace4', 'applicantrace5', 'coapplicantrace1', 'coapplicantrace2', 'coapplicantrace3', 'coapplicantrace4', 'coapplicantrace5', 'applicantethnicity', 'coapplicantethnicity', 'applicantincome', 'ratespread', 'lienstatus', 'hoepastatus', 'purchasertype', 'loanamount', 'asofdate', 'hud_median_family_income', 'minority_population_pct', 'tract_to_msa_md_income' ]
from pylab import * from sklearn.cross_validation import cross_val_score #from years_of_milwaukee import call_2009 #from years_of_milwaukee import call_2010 #from years_of_milwaukee import call_2011 #from years_of_milwaukee import call_2012 #from years_of_milwaukee import call_2013 #from years_of_milwaukee import call_tracts_2013 as tracts_2013 #from years_of_milwaukee import call_tracts_2012 as tracts_2012 #from years_of_milwaukee import call_tracts_2011 as tracts_2011 #from years_of_milwaukee import call_tracts_2010 as tracts_2010 #from years_of_milwaukee import call_tracts_2009 as tracts_2009 #instantiate classes #geo = geo_aggregator() #disabled geo_aggregator as it has been used and is not needed query = queries() connect = connect_DB() parse = parse_inputs() HMDA_cols = ['statecode', 'countycode', 'censustractnumber', 'applicantrace1', 'applicantrace2', 'applicantrace3', 'applicantrace4', 'applicantrace5', 'coapplicantrace1', 'coapplicantrace2', 'coapplicantrace3', 'coapplicantrace4', 'coapplicantrace5', 'applicantethnicity', 'coapplicantethnicity', 'applicantincome', 'ratespread', 'lienstatus', 'hoepastatus', 'purchasertype', 'loanamount', 'year', 'median_family_income', 'minority_population_pct', 'tract_to_msa_md_income', 'actiontype', 'gender'] '''data have been filtered as follows in SQL queries loan type: conventional only, code 1 property type: 1-4 family only, code 1 loan purpose: purchase only, code 1 occupancy status: owner occupied only, code 1 lien status: first liens only, code 1 income != 0 #removes most non-natural person loans action type: originations includes only originated loans, applications includes codes 1-4
#from geo_aggregator_2013 import geo_aggregator from DAT4_library import connect_DB from DAT4_library import parse_inputs import pandas as pd import numpy as np import matplotlib.pyplot as plt from pylab import * from years_of_milwaukee import call_2009 from years_of_milwaukee import call_2010 from years_of_milwaukee import call_2011 from years_of_milwaukee import call_2012 from years_of_milwaukee import call_2013 #instantiate classes #geo = geo_aggregator() #disabled geo_aggregator as it has been used and is not needed query = queries() connect = connect_DB() parse = parse_inputs() #mil_2009 = call_2009() #mil_2010 = call_2010() #mil_2011 = call_2011() #mil_2012 = call_2012() mil_2013 = call_2013() class year_calls(object): pass class call_tracts_2013(year_calls): def __init__(self):