fixing eco3 matching for ha63

This commit is contained in:
Khalim Conn-Kowlessar 2024-03-07 21:46:44 +00:00
parent 19850f9244
commit 47b97fce0a

View file

@ -174,6 +174,7 @@ class DataLoader:
"HA16": 7,
"HA24": 12,
"HA50": 4,
"HA63": 15,
"HA107": 51,
"HA48": 0
}
@ -182,6 +183,7 @@ class DataLoader:
"HA25": 154,
"HA41": 26,
"HA50": 5,
"HA63": 0
}
def __init__(self, directories, december_figures_filepath, use_cache, rebuild):
@ -1746,6 +1748,25 @@ class DataLoader:
"FREDRICK ROAD", "Frederick Road"
)
# For denmark street, remove the space from the house number
eco3_list["NO "] = np.where(
eco3_list["Street / Block Name"] == "DENMARK STREET",
eco3_list["NO "].str.replace(" ", ""),
eco3_list["NO "]
)
eco3_list["Street / Block Name"] = eco3_list["Street / Block Name"].str.replace(
"OLD HOSPITAL MEWS HOSPITAL WALK", "Old Hospital Mews"
)
eco3_list["Street / Block Name"] = eco3_list["Street / Block Name"].str.replace(
"Portland House, Portland Street", "Portland House"
)
eco3_list["Street / Block Name"] = eco3_list["Street / Block Name"].str.replace(
"MIDDLE MARKET STREET", "Middle Market Road"
)
return eco3_list
def merge_eco3_to_assets(self, asset_list, eco3_list, ha_name):
@ -1791,7 +1812,7 @@ class DataLoader:
if isinstance(house_number, str):
house_number = house_number.lower().strip()
if not any(df["matching_address"].str.contains(str(house_number))):
if not any(df["HouseNo"].str.contains(str(house_number))):
if "flat" in str(house_number):
house_number = house_number.split("flat")[1].strip()
@ -1839,10 +1860,6 @@ class DataLoader:
f"Unmatched addresses for {ha_name} is not as expected, got {len(missed)} unmatched"
)
# 41
missed_df = eco3_list[eco3_list["eco3_list_row_id"].isin(missed)]
missed_df.head(1)["Street / Block Name"]
matching_lookup = pd.DataFrame(matching_lookup)
# Check dupes as this will cause problems later on
if matching_lookup["asset_list_row_id"].duplicated().any():