From e7c0b9169cffafef4898131d4e3fc0e4e4421827 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Fri, 19 Jan 2024 11:34:09 +0000 Subject: [PATCH] fixing datetime bug in SearchEpc --- backend/SearchEpc.py | 2 +- backend/app/plan/router.py | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/backend/SearchEpc.py b/backend/SearchEpc.py index d69d8d86..4f6fd33d 100644 --- a/backend/SearchEpc.py +++ b/backend/SearchEpc.py @@ -472,7 +472,7 @@ class SearchEpc: if not epc_data.empty: # Further processing of the EPC data - epc_data['lodgement-datetime'] = pd.to_datetime(epc_data['lodgement-datetime'], format='mixed') + epc_data['lodgement-datetime'] = pd.to_datetime(epc_data['lodgement-datetime'], errors='coerce') epc_data = epc_data.sort_values("lodgement-datetime", ascending=False).groupby("uprn").head(1) epc_data["house_number"] = epc_data["address"].apply(lambda add1: self.get_house_number(add1)) epc_data["numeric_house_number"] = epc_data["house_number"].apply( diff --git a/backend/app/plan/router.py b/backend/app/plan/router.py index d3471e8f..39944fe3 100644 --- a/backend/app/plan/router.py +++ b/backend/app/plan/router.py @@ -66,18 +66,18 @@ async def trigger_plan(body: PlanTriggerRequest): ) # For testing: - plan_input.extend( - [ - {'address': '73 Long Chaulden', 'postcode': 'HP1 2HX', 'Notes': ''}, - {'address': '8 Lindlings', 'postcode': 'HP1 2HA', 'Notes': ''}, - {'address': '44 Lindlings', 'postcode': 'HP1 2HE', 'Notes': ''}, - {'address': '46 Chaulden Terrace', 'postcode': 'HP1 2AN', 'Notes': ''}, - {'address': '4, Heather Shaw', 'postcode': 'BA14 7JS', 'Notes': ''}, - {'address': '16 Glastonbury Road', 'postcode': 'M32 9PE', 'Notes': ''}, - {'address': '31 Loddon Way', 'postcode': 'BA15 1HG', 'Notes': ''}, - {'address': '62 Pearmain Drive', 'postcode': 'NG3 3DJ', 'Notes': ''}, - ] - ) + # plan_input.extend( + # [ + # {'address': '73 Long Chaulden', 'postcode': 'HP1 2HX', 'Notes': ''}, + # {'address': '8 Lindlings', 'postcode': 'HP1 2HA', 'Notes': ''}, + # {'address': '44 Lindlings', 'postcode': 'HP1 2HE', 'Notes': ''}, + # {'address': '46 Chaulden Terrace', 'postcode': 'HP1 2AN', 'Notes': ''}, + # {'address': '4, Heather Shaw', 'postcode': 'BA14 7JS', 'Notes': ''}, + # {'address': '16 Glastonbury Road', 'postcode': 'M32 9PE', 'Notes': ''}, + # {'address': '31 Loddon Way', 'postcode': 'BA15 1HG', 'Notes': ''}, + # {'address': '62 Pearmain Drive', 'postcode': 'NG3 3DJ', 'Notes': ''}, + # ] + # ) input_properties = [] for config in plan_input: