def jeffco_600_Individuals(dataframe): """ Jeffco ASTP600 file: OWNNAM OWNNAM2 OWNNAM3 OWNICO DBA """ from db import Individuals try: Individuals.create_table() except: pass ownerfields = ['OWNNAM', 'OWNNAM2', 'OWNNAM3', 'OWNICO', 'DBA'] all_owners = set() for o in ownerfields: all_owners |= set(dataframe[o][(dataframe[o].notnull())]) careofnames = set(dataframe['OWNICO'][(dataframe['OWNICO'].notnull())]) dba = set(dataframe['DBA'][(dataframe['DBA'].notnull())]) count = 0 careofnames = set(x.replace('%', '').strip() for x in careofnames) dba = set(x.replace('%', '').strip() for x in dba) print('ABEL RICHARD A' in all_owners) for i in all_owners: i.replace('%', '') i = i.strip() OWNICO = i in careofnames DBA = i in dba ind = Individuals.create(Name=i, OWNICO=OWNICO, DBA=DBA) count += 1 print('Added {} owners'.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)