mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
added manual match
This commit is contained in:
parent
7dd6478172
commit
0331d82f6a
1 changed files with 14 additions and 6 deletions
|
|
@ -3267,15 +3267,19 @@ def revised_model():
|
|||
columns={"Post Code": "Postcode"}
|
||||
)
|
||||
ccs_coordination = ccs_coordination[~pd.isnull(ccs_coordination["Postcode"])]
|
||||
ccs_coordination = ccs_coordination[ccs_coordination["Retrofit Assessment"] != "Outstanding"]
|
||||
from fuzzywuzzy import fuzz
|
||||
|
||||
ccs_manual_filters = {}
|
||||
ccs_manual_filters = {
|
||||
"35 Kittiwake Close": "Wave 2.1 Surveys/11. CCS Dorset/Kittiwake Close 35"
|
||||
}
|
||||
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 ccs_manual_filters:
|
||||
filtered = retrofit_assessment_data[
|
||||
retrofit_assessment_data["survey_folder"] == manual_filters[home["Name"]]
|
||||
retrofit_assessment_data["survey_folder"] == ccs_manual_filters[home["Name"]]
|
||||
].copy()
|
||||
else:
|
||||
filtered = retrofit_assessment_data[
|
||||
|
|
@ -3297,11 +3301,15 @@ def revised_model():
|
|||
)
|
||||
)
|
||||
if to_filter.sum() == 0:
|
||||
to_filter = filtered["Address"].str.replace(" ,", "").str.split(",").str[0:2].str.join("") == home[
|
||||
"Name"]
|
||||
to_filter = (
|
||||
filtered["Address"].str.replace(" ,", "").str.split(",").str[0:2].str.join("").str.lower() ==
|
||||
home["Name"].lower()
|
||||
)
|
||||
if to_filter.sum() == 0:
|
||||
to_filter = filtered["Address"].str.replace(" ,", "").str.split(",").str[0:1].str.join("") == home[
|
||||
"Name"]
|
||||
to_filter = (
|
||||
filtered["Address"].str.replace(" ,", "").str.split(",").str[0:1].str.join("").str.lower() ==
|
||||
home["Name"].lower()
|
||||
)
|
||||
if to_filter.sum() == 0:
|
||||
# Do a fuzzy match on the name
|
||||
# Find the best filter
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue