@@ -11,11 +11,11 @@ def find_locations_from_cache(df, filename: str, update_cache=True):
1111 print (f"No cache found at { filename } , starting with an empty cache." )
1212 cache = gpd .GeoDataFrame (columns = ["city" , "geometry" ], crs = "EPSG:4326" )
1313
14- cities_found = set (df ["city " ]) & set (cache ["city" ])
14+ cities_found = set (df ["city_full " ]) & set (cache ["city" ])
1515 locations_found = cache [cache ["city" ].isin (cities_found )]
1616
1717 # for cities not found in cache, geocode and add to cache
18- locs_not_found = set (df ["city " ]) - set (cache ["city" ])
18+ locs_not_found = set (df ["city_full " ]) - set (cache ["city" ])
1919 if locs_not_found :
2020 print (f"Locations not found in cache: { locs_not_found } " )
2121 locs_new = gpd .tools .geocode (list (locs_not_found ))
@@ -28,8 +28,8 @@ def find_locations_from_cache(df, filename: str, update_cache=True):
2828 )
2929
3030 # ensure locations matches the order of df and avoid dtype mismatch errors
31- merge_df = df [["city " ]].copy ()
32- merge_df ["city" ] = merge_df ["city " ].astype (str )
31+ merge_df = df [["city_full " ]].copy ()
32+ merge_df ["city" ] = merge_df ["city_full " ].astype (str )
3333 locations ["city" ] = locations ["city" ].astype (str )
3434 locations = merge_df .merge (locations , on = "city" , how = "left" )
3535 locations = gpd .GeoDataFrame (locations , geometry = "geometry" )
0 commit comments