From 9057b3d4da71f3dd63a8ae2924a073f6cc168dc8 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Tue, 19 Nov 2024 22:04:19 +0000 Subject: [PATCH] fixing assignment of package ref --- etl/customers/stonewater/Wave 3 Preparation.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/etl/customers/stonewater/Wave 3 Preparation.py b/etl/customers/stonewater/Wave 3 Preparation.py index f4195592..4a841f61 100644 --- a/etl/customers/stonewater/Wave 3 Preparation.py +++ b/etl/customers/stonewater/Wave 3 Preparation.py @@ -2126,8 +2126,16 @@ def propsed_wave_3_sample(): ) expected_epc = sap_to_epc(expected_sap) + archetype_data = archetype_data.sort_values("distance_meters", ascending=True) + # We take the features of the closest matching property - closest_match = archetype_data.sort_values("distance_meters", ascending=True).iloc[0] + closest_match = archetype_data.iloc[0] + + # Set the package ref + if expected_epc in ["C", "B", "A"]: + package_ref = None + else: + package_ref = archetype_data["Package Ref"].dropna().values[0] region_surveyed.append( { @@ -2141,7 +2149,7 @@ def propsed_wave_3_sample(): 'Survey: Primary Heating System': closest_match["Survey: Primary Heating System"], "Survey: Matching Address ID": closest_match["Address ID"], 'Distance to Closest Match (m)': closest_match["distance_meters"], - "Package Ref": closest_match["Package Ref"], + "Package Ref": package_ref, "Match Type": match_type } )