mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
comment out temp code
This commit is contained in:
parent
761c1441c7
commit
52578287a7
1 changed files with 79 additions and 89 deletions
|
|
@ -9,96 +9,86 @@ import pytest
|
||||||
from utils.s3 import read_dataframe_from_s3_parquet
|
from utils.s3 import read_dataframe_from_s3_parquet
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
|
|
||||||
# Handy code for selecting testin data
|
# Handy code for selecting testin data
|
||||||
import pickle
|
# import pickle
|
||||||
|
#
|
||||||
with open("sap_change_dataset.pickle", "rb") as f:
|
# with open("sap_change_dataset.pickle", "rb") as f:
|
||||||
sap_change_dataset = pickle.load(f)
|
# sap_change_dataset = pickle.load(f)
|
||||||
|
#
|
||||||
z = sap_change_dataset[(sap_change_dataset["NUMBER_OPEN_FIREPLACES_ENDING"] > 0) & (
|
# search_from = sap_change_dataset[
|
||||||
sap_change_dataset["NUMBER_OPEN_FIREPLACES_STARTING"] > 0)].head(2).tail(1)
|
# (sap_change_dataset["walls_thermal_transmittance_ENDING"] == sap_change_dataset["walls_thermal_transmittance"])
|
||||||
z["UPRN"]
|
# ]
|
||||||
z["SAP_STARTING"]
|
# search_from = search_from[
|
||||||
z["SAP_ENDING"]
|
# (search_from["roof_thermal_transmittance_ENDING"] == search_from["roof_thermal_transmittance"]) &
|
||||||
z["NUMBER_OPEN_FIREPLACES_STARTING"]
|
# (search_from["floor_thermal_transmittance_ENDING"] == search_from["floor_thermal_transmittance"]) &
|
||||||
z["NUMBER_OPEN_FIREPLACES_ENDING"]
|
# (search_from["MECHANICAL_VENTILATION_ENDING"] == search_from["MECHANICAL_VENTILATION_STARTING"]) &
|
||||||
|
# (search_from["SECONDHEAT_DESCRIPTION_ENDING"] == search_from["SECONDHEAT_DESCRIPTION_STARTING"]) &
|
||||||
# 10002083298
|
# (search_from["GLAZED_TYPE_ENDING"] == search_from["GLAZED_TYPE_STARTING"]) &
|
||||||
|
# (search_from["NUMBER_OPEN_FIREPLACES_STARTING"] > 0) &
|
||||||
# m
|
# (search_from["NUMBER_OPEN_FIREPLACES_ENDING"] == 0)
|
||||||
search_from = sap_change_dataset[
|
# ]
|
||||||
(sap_change_dataset["walls_thermal_transmittance_ENDING"] == sap_change_dataset["walls_thermal_transmittance"])
|
#
|
||||||
]
|
# # Find a record where the only difference is cavity wall getting filled
|
||||||
search_from = search_from[
|
# ending_cols = [c for c in search_from.columns if "_ENDING" in c]
|
||||||
(search_from["roof_thermal_transmittance_ENDING"] == search_from["roof_thermal_transmittance"]) &
|
#
|
||||||
(search_from["floor_thermal_transmittance_ENDING"] == search_from["floor_thermal_transmittance"]) &
|
# ignore = [
|
||||||
(search_from["MECHANICAL_VENTILATION_ENDING"] == search_from["MECHANICAL_VENTILATION_STARTING"]) &
|
# "SAP_ENDING", "HEAT_DEMAND_ENDING", "CARBON_ENDING", "TRANSACTION_TYPE_ENDING", "FLOOR_HEIGHT_ENDING",
|
||||||
(search_from["SECONDHEAT_DESCRIPTION_ENDING"] == search_from["SECONDHEAT_DESCRIPTION_STARTING"]) &
|
# "DAYS_TO_ENDING", "TOTAL_FLOOR_AREA_ENDING"
|
||||||
(search_from["GLAZED_TYPE_ENDING"] == search_from["GLAZED_TYPE_STARTING"]) &
|
# ]
|
||||||
(search_from["NUMBER_OPEN_FIREPLACES_STARTING"] > 0) &
|
#
|
||||||
(search_from["NUMBER_OPEN_FIREPLACES_ENDING"] == 0)
|
# ending_cols = [c for c in ending_cols if c not in ignore]
|
||||||
]
|
#
|
||||||
|
# for _, row in tqdm(search_from.iterrows(), total=search_from.shape[0]):
|
||||||
# Find a record where the only difference is cavity wall getting filled
|
#
|
||||||
ending_cols = [c for c in search_from.columns if "_ENDING" in c]
|
# same = True
|
||||||
|
# starting_cols = []
|
||||||
ignore = [
|
# for c in ending_cols:
|
||||||
"SAP_ENDING", "HEAT_DEMAND_ENDING", "CARBON_ENDING", "TRANSACTION_TYPE_ENDING", "FLOOR_HEIGHT_ENDING",
|
#
|
||||||
"DAYS_TO_ENDING", "TOTAL_FLOOR_AREA_ENDING"
|
# starting_col = c.replace("_ENDING", "")
|
||||||
]
|
# if starting_col not in search_from.columns:
|
||||||
|
# starting_col = c.replace("_ENDING", "_STARTING")
|
||||||
ending_cols = [c for c in ending_cols if c not in ignore]
|
# if starting_col not in search_from.columns:
|
||||||
|
# raise Exception("something went wrong")
|
||||||
for _, row in tqdm(search_from.iterrows(), total=search_from.shape[0]):
|
#
|
||||||
|
# starting_cols.append(starting_col)
|
||||||
same = True
|
#
|
||||||
starting_cols = []
|
# # We want them to be different
|
||||||
for c in ending_cols:
|
# if c == "NUMBER_OPEN_FIREPLACES_ENDING":
|
||||||
|
# if (row[c] == row[starting_col]) | (row[starting_col] != "natural"):
|
||||||
starting_col = c.replace("_ENDING", "")
|
# same = False
|
||||||
if starting_col not in search_from.columns:
|
# break
|
||||||
starting_col = c.replace("_ENDING", "_STARTING")
|
# else:
|
||||||
if starting_col not in search_from.columns:
|
# continue
|
||||||
raise Exception("something went wrong")
|
#
|
||||||
|
# # We now check if the starting and ending values are the same
|
||||||
starting_cols.append(starting_col)
|
# if row[c] != row[starting_col]:
|
||||||
|
# same = False
|
||||||
# We want them to be different
|
# break
|
||||||
if c == "NUMBER_OPEN_FIREPLACES_ENDING":
|
#
|
||||||
if (row[c] == row[starting_col]) | (row[starting_col] != "natural"):
|
# if same:
|
||||||
same = False
|
# raise Exception("We found one!")
|
||||||
break
|
#
|
||||||
else:
|
# fixed_cols = [c for c in search_from.columns if c not in starting_cols + ending_cols]
|
||||||
continue
|
#
|
||||||
|
# import pandas as pd
|
||||||
# We now check if the starting and ending values are the same
|
#
|
||||||
if row[c] != row[starting_col]:
|
# start = row[["SAP_STARTING"] + starting_cols]
|
||||||
same = False
|
# start.index = [c.replace("_STARTING", "") for c in start.index]
|
||||||
break
|
# end = row[["SAP_ENDING"] + ending_cols]
|
||||||
|
# end.index = [c.replace("_ENDING", "") for c in end.index]
|
||||||
if same:
|
# start["type"] = "starting"
|
||||||
raise Exception("We found one!")
|
# end["type"] = "ending"
|
||||||
|
#
|
||||||
fixed_cols = [c for c in search_from.columns if c not in starting_cols + ending_cols]
|
# compare = pd.concat([start, end], axis=1)
|
||||||
|
#
|
||||||
import pandas as pd
|
# ending_lmk = "bab3983fa167717b8bb4a36ef395046d53937f9b880a45bcc751270d72e5de45"
|
||||||
|
# starting_lmk = "736b6f4803a11d9e45b49bf98f36eb8a7f357b0dd24f3e7cddef5295518e5bef"
|
||||||
start = row[["SAP_STARTING"] + starting_cols]
|
#
|
||||||
start.index = [c.replace("_STARTING", "") for c in start.index]
|
# client = EpcClient(auth_token=EPC_AUTH_TOKEN)
|
||||||
end = row[["SAP_ENDING"] + ending_cols]
|
# result = client.domestic.search(params={"address": "9 Glebe Road, Asfordby Hill", "postcode": "LE14 3QT"})
|
||||||
end.index = [c.replace("_ENDING", "") for c in end.index]
|
# starting_epc = [x for x in result["rows"] if x["lmk-key"] == starting_lmk][0]
|
||||||
start["type"] = "starting"
|
# ending_epc = [x for x in result["rows"] if x["lmk-key"] == ending_lmk][0]
|
||||||
end["type"] = "ending"
|
|
||||||
|
|
||||||
compare = pd.concat([start, end], axis=1)
|
|
||||||
|
|
||||||
ending_lmk = "bab3983fa167717b8bb4a36ef395046d53937f9b880a45bcc751270d72e5de45"
|
|
||||||
starting_lmk = "736b6f4803a11d9e45b49bf98f36eb8a7f357b0dd24f3e7cddef5295518e5bef"
|
|
||||||
|
|
||||||
client = EpcClient(auth_token=EPC_AUTH_TOKEN)
|
|
||||||
result = client.domestic.search(params={"address": "9 Glebe Road, Asfordby Hill", "postcode": "LE14 3QT"})
|
|
||||||
starting_epc = [x for x in result["rows"] if x["lmk-key"] == starting_lmk][0]
|
|
||||||
ending_epc = [x for x in result["rows"] if x["lmk-key"] == ending_lmk][0]
|
|
||||||
|
|
||||||
|
|
||||||
# with open(
|
# with open(
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue