mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Added more logic for matching
This commit is contained in:
parent
231069f4e3
commit
7dd6478172
1 changed files with 8 additions and 5 deletions
|
|
@ -3273,7 +3273,7 @@ def revised_model():
|
|||
ccs_matching_lookup = []
|
||||
for _, home in tqdm(ccs_coordination.iterrows(), total=len(ccs_coordination)):
|
||||
# Handle the case that has the wrong postcode in the asset data
|
||||
if home["Name"] in manual_filters:
|
||||
if home["Name"] in ccs_manual_filters:
|
||||
filtered = retrofit_assessment_data[
|
||||
retrofit_assessment_data["survey_folder"] == manual_filters[home["Name"]]
|
||||
].copy()
|
||||
|
|
@ -3297,13 +3297,16 @@ def revised_model():
|
|||
)
|
||||
)
|
||||
if to_filter.sum() == 0:
|
||||
to_filter = filtered["Address"].str.split(",").str[0:2].str.join("") == home["Name"]
|
||||
|
||||
to_filter = filtered["Address"].str.replace(" ,", "").str.split(",").str[0:2].str.join("") == home[
|
||||
"Name"]
|
||||
if to_filter.sum() == 0:
|
||||
to_filter = filtered["Address"].str.replace(" ,", "").str.split(",").str[0:1].str.join("") == home[
|
||||
"Name"]
|
||||
if to_filter.sum() == 0:
|
||||
# Do a fuzzy match on the name
|
||||
# Find the best filter
|
||||
to_filter = filtered["Address"].str.split(",").str[0:2].str.join("").apply(
|
||||
lambda x: fuzz.partial_ratio(home["Name"], x) > 9
|
||||
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:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue