Added in the re-labelling of assets based on eco3 merge

This commit is contained in:
Khalim Conn-Kowlessar 2024-03-07 13:59:32 +00:00
parent 961b53d523
commit 7f88f0e0f5

View file

@ -1812,6 +1812,7 @@ class DataLoader:
asset_list = data_assets["asset_list"].copy()
survey_list = data_assets["survey_list"].copy()
ciga_list = data_assets["ciga_list"].copy()
eco3_list = data_assets.get("eco3_list", pd.DataFrame())
asset_list_starting_size = asset_list.shape[0]
@ -1859,6 +1860,25 @@ class DataLoader:
if asset_list.shape[0] != asset_list_starting_size:
raise ValueError("The asset list has changed in size")
# If we have eco3 surveys, we set a property to not eligible
if not eco3_list.empty:
eco3_list_to_merge = eco3_list[["asset_list_row_id"]].copy()
eco3_list_to_merge["has_eco3"] = True
asset_list = asset_list.merge(
eco3_list_to_merge, how="left", on="asset_list_row_id"
)
if asset_list.shape[0] != asset_list_starting_size:
raise ValueError("The asset list has changed in size, when merging on eco3")
# Any rows that have an eco3 survey are set to not eligible
asset_list["ECO Eligibility"] = np.where(
asset_list["has_eco3"] == True,
"not eligible",
asset_list["ECO Eligibility"]
)
asset_list = asset_list.drop(columns=["has_eco3"])
# Report on sales
sales_report = {}
if not survey_list.empty: