From e1383b3432250eaecf3110577f3e254d860d921c Mon Sep 17 00:00:00 2001 From: Tudor Date: Sat, 10 Jan 2026 11:25:21 +0000 Subject: [PATCH] Fix postcode search ValueError when calculating distances 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 --- backend/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/app.py b/backend/app.py index 2a2e043..d0f5dcd 100644 --- a/backend/app.py +++ b/backend/app.py @@ -277,7 +277,7 @@ async def get_schools( # Filter by distance using pre-geocoded lat/long from database 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 haversine_distance( search_coords[0],