Fix postcode search ValueError when calculating distances
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 59s

Use direct bracket indexing instead of .get() for pandas Series
row access in calc_distance function to ensure scalar values
are returned for pd.isna() checks.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Tudor
2026-01-10 11:25:21 +00:00
parent 3c1e7b4b27
commit e1383b3432

View File

@@ -277,7 +277,7 @@ async def get_schools(
# Filter by distance using pre-geocoded lat/long from database # Filter by distance using pre-geocoded lat/long from database
def calc_distance(row): def calc_distance(row):
if pd.isna(row.get("latitude")) or pd.isna(row.get("longitude")): if pd.isna(row["latitude"]) or pd.isna(row["longitude"]):
return float("inf") return float("inf")
return haversine_distance( return haversine_distance(
search_coords[0], search_coords[0],