fixed matching for ha28

This commit is contained in:
Khalim Conn-Kowlessar 2024-03-03 15:57:49 +00:00
parent cb39590f61
commit 0909b811ee

View file

@ -887,6 +887,27 @@ class DataLoader:
def correct_ha28_survey_list(survey_list):
# Rename the "No" column to "No." to align with the other survey sheets
survey_list = survey_list.rename(columns={"NO ": "NO."})
survey_list["Post Code"] = np.where(
survey_list["Post Code"] == "ME75HA",
"ME7 5HA",
survey_list["Post Code"]
)
survey_list["Street / Block Name"] = survey_list["Street / Block Name"].str.replace(
"ANDREW MANOR/BRITTON ST", "ANDREW MANOR"
)
survey_list["Post Code"] = np.where(
survey_list["Post Code"] == "ME75TW",
"ME7 5TW",
survey_list["Post Code"]
)
survey_list["Street / Block Name"] = survey_list["Street / Block Name"].str.replace(
"ST MARKS HOUSE/SAXON ST", "ST MARKS HOUSE"
)
return survey_list
@staticmethod
@ -1046,7 +1067,7 @@ class DataLoader:
asset_list["matching_address"].str.contains(row["Street / Block Name"].lower().strip())
].copy()
if str(house_number) not in df["matching_address"].values:
if not any(df["matching_address"].str.contains(str(house_number))):
if "flat" in str(house_number):
house_number = house_number.split("flat")[1].strip()