fixed sap05 downgrade

This commit is contained in:
Khalim Conn-Kowlessar 2025-12-13 23:21:25 +08:00
parent 6fdde5ee40
commit d65fc22ad4
2 changed files with 20 additions and 10 deletions

View file

@ -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:

View file

@ -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)