diff --git a/backend/SearchEpc.py b/backend/SearchEpc.py index ae34c49a..b400b8f1 100644 --- a/backend/SearchEpc.py +++ b/backend/SearchEpc.py @@ -456,6 +456,9 @@ class SearchEpc: epc_data["weight"] = 1 / (epc_data["house_number_distance"] + 1) # If we have a home without a house number, fill that weight with average epc_data["weight"] = epc_data["weight"].fillna(epc_data["weight"].mean()) + # Finally, we might not have any house numbers whatsoever so everything could be + # missing, so we fill with 1 + epc_data["weight"] = epc_data["weight"].fillna(1) epc_built_form = self._estimate_str(key="built-form", estimation_data=epc_data) epc_property_type = self._estimate_str(key="property-type", estimation_data=epc_data) diff --git a/etl/testing_data/estimate_epc.py b/etl/testing_data/estimate_epc.py index 7dc669f9..a6c6ea6c 100644 --- a/etl/testing_data/estimate_epc.py +++ b/etl/testing_data/estimate_epc.py @@ -137,6 +137,7 @@ def app(): # Get aggregate performance figures results_df = pd.DataFrame(results) + results_df["tenure"] = results_df["tenure"].replace("Rented (social)", "rental (social)") avg_numeric_succes = results_df["numeric_success"].median() avg_categorical_sucess = results_df["categorical_success"].median()