fixing merge

This commit is contained in:
Khalim Conn-Kowlessar 2024-03-02 13:26:54 +00:00
parent dad2fc74c8
commit 9eccfca70d

View file

@ -214,6 +214,13 @@ class DataLoader:
asset_list["Postcode"].astype(str).str.lower().str.strip()
)
asset_list["matching_postcode"] = asset_list["Postcode"].astype(str).str.lower().str.strip()
elif ha_name == "HA32":
asset_list["matching_address"] = (
asset_list["Dwelling num"].astype(str).str.lower().str.strip() + ", " +
asset_list["Street"].astype(str).str.lower().str.strip() + ", " +
asset_list["Postcode"].astype(str).str.lower().str.strip()
)
asset_list["matching_postcode"] = asset_list["Postcode"].astype(str).str.lower().str.strip()
elif ha_name == "HA39":
# Create matching_address by concatenating add_1, add_2, add_3, add_4, add_5, post_code
asset_list["matching_address"] = asset_list["add_1"].astype(str).str.lower().str.strip() + ", " + \
@ -308,6 +315,8 @@ class DataLoader:
if ha_name in ["HA107"]:
asset_list["HouseNo"] = asset_list["House No"].copy()
elif ha_name == "HA32":
asset_list["HouseNo"] = asset_list["Dwelling num"].copy()
else:
split_addresses = asset_list['matching_address'].str.split(',', expand=True)
house_numbers = split_addresses[0].str.split(' ', expand=True)
@ -520,6 +529,16 @@ class DataLoader:
)
return asset_list
@staticmethod
def correct_ha32_asset_list(asset_list):
asset_list["Postcode"] = np.where(
(asset_list["Street"] == "Norton Grove") & (asset_list["Postcode"] == "HU4 6HQ") & (
asset_list["Dwelling num"] == "7"),
"hu4 6hg",
asset_list["Postcode"]
)
return asset_list
@staticmethod
def correct_ha6_survey_list(survey_list):
@ -845,6 +864,50 @@ class DataLoader:
return survey_list
@staticmethod
def correct_ha32_survey_list(survey_list):
survey_list["Street / Block Name"] = np.where(
survey_list["Street / Block Name"] == "Coxwold",
"Coxwold Grove",
survey_list["Street / Block Name"]
)
# Update the Barringhton Avenue with their correct spelling: Barrington Avenue
survey_list["Street / Block Name"] = np.where(
survey_list["Street / Block Name"] == "Barringhton Avenue",
"Barrington Avenue",
survey_list["Street / Block Name"]
)
# Update how the Rustenburn addresses are listed in the identified addresses
survey_list["Street / Block Name"] = np.where(
survey_list["Street / Block Name"] == "Rustenburg",
"Rustenburg Street",
survey_list["Street / Block Name"]
)
# Update how the MALIN LODGE, RONALDSWAY CLOSE addresses are listed in the identified addresses
survey_list["Street / Block Name"] = np.where(
survey_list["Street / Block Name"] == "MALIN LODGE, RONALDSWAY CLOSE",
"Malin Lodge",
survey_list["Street / Block Name"]
)
# Update how the Feroes Close are listed in the identified addresses
survey_list["Street / Block Name"] = np.where(
survey_list["Street / Block Name"] == "Feroes Close",
"Faroes Close",
survey_list["Street / Block Name"]
)
survey_list["Street / Block Name"] = np.where(
survey_list["Street / Block Name"] == 'FORESTER WAY',
'FORESTER WAY',
survey_list["Street / Block Name"]
)
return survey_list
@staticmethod
def correct_ha107_survey_list(survey_list):
# Replace Front Street, East Stockham with Front Street, East Stockwith
@ -3350,9 +3413,9 @@ def app():
december_figures_filepath = "local_data/ha_data/HA_December_figures.csv"
priority_has = [
"HA1", "HA6", "HA7", "HA14", "HA15", "HA16", "HA24", "HA25", "HA39", "HA107"
"HA1", "HA6", "HA7", "HA14", "HA15", "HA16", "HA24", "HA25", "HA32", "HA39", "HA107"
]
# Next HAs to do: 15, 32, 33,
# Next HAs to do: 15[DONE], 32, 33,
# Then: 28, 41, 38, 10, 14, 20, 48
# Filter down the directories to only the priority HAs
directories = [d for d in directories if d.split("/")[2] in priority_has]