mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
handling the case of null built form
This commit is contained in:
parent
98e6265b5d
commit
0d154abc3d
1 changed files with 13 additions and 8 deletions
|
|
@ -472,8 +472,9 @@ class SearchEpc:
|
|||
# missing, so we fill with 1
|
||||
epc_data["weight"] = epc_data["weight"].fillna(1)
|
||||
|
||||
epc_property_type = self._estimate_str(key="property-type", estimation_data=epc_data)
|
||||
estimation_property_type = epc_property_type if property_type == "" else property_type
|
||||
estimation_property_type = self._estimate_str(
|
||||
key="property-type", estimation_data=epc_data
|
||||
) if property_type == "" else property_type
|
||||
|
||||
epc_built_form = self._estimate_str(
|
||||
key="built-form",
|
||||
|
|
@ -482,7 +483,7 @@ class SearchEpc:
|
|||
|
||||
if built_form == "Semi-Detached" and epc_built_form in ["End-Terraced", "Mid-Terraced"]:
|
||||
estimation_built_form = "End-Terraced"
|
||||
elif built_form == "":
|
||||
elif (built_form == "") or (pd.isnull(built_form)):
|
||||
estimation_built_form = epc_built_form
|
||||
else:
|
||||
estimation_built_form = built_form
|
||||
|
|
@ -492,13 +493,17 @@ class SearchEpc:
|
|||
# We also add some additional logic for Park homes, because they are far less common than other
|
||||
# property types
|
||||
|
||||
if (estimation_property_type == "Maisonette") & (
|
||||
is_maisonette_with_bad_built_form = (estimation_property_type == "Maisonette") & (
|
||||
estimation_built_form in ["Detached", "Semi-Detached"]
|
||||
):
|
||||
epc_data = epc_data[epc_data["property-type"] == estimation_property_type]
|
||||
elif (estimation_property_type == "Park home") & (
|
||||
)
|
||||
|
||||
is_park_home_without_built_form = (estimation_property_type == "Park home") & (
|
||||
sum(epc_data["built-form"] == estimation_built_form) == 0
|
||||
):
|
||||
)
|
||||
|
||||
has_missing_built_form = not estimation_built_form
|
||||
|
||||
if is_maisonette_with_bad_built_form or is_park_home_without_built_form or has_missing_built_form:
|
||||
epc_data = epc_data[epc_data["property-type"] == estimation_property_type]
|
||||
else:
|
||||
epc_data = epc_data[
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue