From d65fc22ad4e8c78bf25b694875638cb933f1e915 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Sat, 13 Dec 2025 23:21:25 +0800 Subject: [PATCH] fixed sap05 downgrade --- backend/Property.py | 2 +- .../c_finalised_modelling_data.py | 28 +++++++++++++------ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/backend/Property.py b/backend/Property.py index 31991702..9a4f8d97 100644 --- a/backend/Property.py +++ b/backend/Property.py @@ -843,7 +843,7 @@ class Property: raise ValueError("Current energy bill has not been set") # IF we have a SAP05 overwrite, we pull out the relevant information - sap_05_overwritten = self.data.get("sap_05_overwritten", False) + sap_05_overwritten = self.data.get("sap-05-overwritten", False) sap_05_score, sap_05_epc_rating = None, None if sap_05_overwritten: diff --git a/etl/customers/peabody/Nov 2025 Consulting Project/c_finalised_modelling_data.py b/etl/customers/peabody/Nov 2025 Consulting Project/c_finalised_modelling_data.py index 2868bce5..b2dfb01e 100644 --- a/etl/customers/peabody/Nov 2025 Consulting Project/c_finalised_modelling_data.py +++ b/etl/customers/peabody/Nov 2025 Consulting Project/c_finalised_modelling_data.py @@ -75,7 +75,7 @@ modelling_data["landlord_property_id"] = sustainability_data["Org Ref"].copy() modelling_data["domna_property_id"] = sustainability_data["Org Ref"].copy() modelling_data = modelling_data.rename( - { + columns={ "Address 1": "domna_address_1", "Postcode": "postcode", "Type": "landlord_property_type", @@ -85,6 +85,15 @@ modelling_data = modelling_data.rename( } ) + +def make_full_address(x): + to_join = [x['domna_address_1'], x['Address 2'], x['Address 3']] + to_join = [x for x in to_join if not pd.isnull(x) and x != ''] + return ", ".join(to_join) + + +modelling_data["domna_full_address"] = modelling_data.apply(lambda x: make_full_address(x), axis=1) + modelling_data = modelling_data[ [ "domna_address_1", "Address 2", "Address 3", "postcode", "landlord_property_type", @@ -104,11 +113,12 @@ modelling_data["landlord_built_form"] = modelling_data["landlord_built_form"].ma } ) - -def make_full_address(x): - to_join = [x['domna_address_1'], x['Address 2'], x['Address 3']] - to_join = [x for x in to_join if not pd.isnull(x) and x != ''] - return ", ".join(to_join) - - -modelling_data["domna_full_address"] = modelling_data.apply(lambda x: make_full_address(x), axis=1) +filename = ("/Users/khalimconn-kowlessar/Documents/hestia/Customers/Peabody/Nov 2025 Consulting Project/20251213 Model " + "data.xlsx") +with pd.ExcelWriter(filename) as writer: + modelling_data.to_excel(writer, sheet_name="Standardised Asset List", index=False) + # Store the three sections + modelling_data[0:30000].to_excel(writer, sheet_name="Part 1", index=False) + modelling_data[30000:60000].to_excel(writer, sheet_name="Part 2", index=False) + modelling_data[60000:].to_excel(writer, sheet_name="Part 3", index=False) + modelling_data.sample(60).to_excel(writer, sheet_name="Random testing sample", index=False)