def grandco_auction(): """ Loads auction result data for grand county :param parceltable: :param lienauction: :return: """ from db import LienAuction, Parcel try: LienAuction.create_table() except: pass dataframe = pd.read_csv('data/GrandCo/All_Results.csv') count = 0 for p in dataframe.iterrows(): data = p[1] try: prop = Parcel.get(Parcel.Parcel_ID == data.Parcel_ID and Parcel.County == 'Grand') except Exception as e: if 'Instance matching query does not exist' in str(e): prop = Parcel.create(Parcel_ID=data.Parcel_ID) else: print('The problem is {}'.format(data.Parcel_ID)) print(e) LienAuction.create(Parcel_ID=prop, Bidder_ID=data.Bidder_ID, Face_Value=data.Face_Value, Name=data.Name, Tax_Year=data.Tax_Year, Winning_Bid=data.Winning_Bid) count += 1 print('Imported {} auction results'.format(count))
def grandco_parcels(): from db import Parcel try: Parcel.create_table() except: pass results = pd.read_csv('data/GrandCo/All_Properties.csv') count = 0 for p in results.Parcel_ID.unique(): prop = Parcel.create(Parcel_ID=p, County='Grand') count += 1 print('Imported {} Parcels'.format(count))
def jeffco_600_Parcels(dataframe): """ Jeffco ASTP600 file: SCH: SCHEDULE NUMBER """ from db import Parcel try: Parcel.create_table() except: pass # "data/JeffersonCo/JeffcoData Nov 2013/CLEANED_ATSDTA_ATSP600.csv" dataframe['SCH'] = pd.to_numeric(dataframe['SCH'], errors='coerce') count = 0 for p in dataframe.SCH.unique(): prop = Parcel.create(Parcel_ID=p, County='Jefferson') count += 1 print('Imported {} Jefferson Parcels'.format(count))
def Jeffco_600_owners(dataframe): """ Connect owners with property :param parceltable: :param indvtable: :param owntable: :param datafile: :return: """ from db import Parcel, Individuals, Owners try: Owners.create_table() except: pass ownerfields = ['OWNNAM', 'OWNNAM2', 'OWNNAM3', 'OWNICO', 'DBA'] for row in dataframe.iterrows(): row = row[1] print(int(row['SCH'])) prop = Parcel.get(Parcel.Parcel_ID == int(row['SCH'])) for i in (row[o] for o in ownerfields): if str(i) != 'nan': indv = Individuals.get(Individuals.Name == i) Owners.create(Owner=indv, Parcel_ID=prop)