matching for all of ccs

This commit is contained in:
Khalim Conn-Kowlessar 2025-01-29 21:03:11 +00:00
parent 0331d82f6a
commit 678a4b52d2

View file

@ -3316,6 +3316,19 @@ def revised_model():
to_filter = filtered["Address"].str.replace(" ,", "").str.split(",").str[0:2].str.join("").apply(
lambda x: fuzz.partial_ratio(home["Name"], x) > 93
)
if to_filter.sum() == 0:
# We also some cases where the name of the survey folder is like "Colville Road 7" and the
# property name is actually 7 Colville Road, so we try taking the final part of the address,
# splitting on space, and adding it to the front
def reformat_survey_folder(x):
filename = x.split("/")[-1]
parts = filename.split(" ")
return " ".join(parts[-1:] + parts[:-1])
to_filter = (
filtered["survey_folder"].apply(lambda x: reformat_survey_folder(x)).str.lower() ==
home["Name"].lower()
)
if to_filter.sum() == 0:
blah