def manual_nodev(parcel_rejections, parcels): df1 = parcels.to_frame(['x', 'y']).dropna(subset=['x', 'y']) df2 = parcel_rejections.to_frame(['lng', 'lat']) df2 = df2[parcel_rejections.state == "denied"] df2 = df2[["lng", "lat"]] # need to change the order ind = nearest_neighbor(df1, df2) s = pd.Series(False, parcels.index) s.loc[ind.flatten()] = True return s.astype('int')
def costar(store, parcels): df = pd.read_csv(os.path.join(misc.data_dir(), '2015_08_29_costar.csv')) df["PropertyType"] = df.PropertyType.replace("General Retail", "Retail") df = df[df.PropertyType.isin(["Office", "Retail", "Industrial"])] df["costar_rent"] = df["Average Weighted Rent"].astype('float') df["year_built"] = df["Year Built"].fillna(1980) df = df.dropna(subset=["costar_rent", "Latitude", "Longitude"]) # now assign parcel id df["parcel_id"] = nearest_neighbor( parcels.to_frame(['x', 'y']).dropna(subset=['x', 'y']), df[['Longitude', 'Latitude']]) return df