mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
tidying up code
This commit is contained in:
parent
9057b3d4da
commit
0fafb03dee
1 changed files with 2 additions and 25 deletions
|
|
@ -2366,10 +2366,8 @@ def propsed_wave_3_sample():
|
|||
|
||||
results = pd.concat(results)
|
||||
|
||||
results[
|
||||
pd.isnull(results["Package Ref"]) & (results["Current EPC Band"] == "D")
|
||||
]["Postal Region"]
|
||||
results[resul]
|
||||
if (pd.isnull(results["Package Ref"]) & (~results["Current EPC Band"].isin(["A", "B", "C"]))).sum():
|
||||
raise ValueError("Missing Package Refs")
|
||||
|
||||
# Check if there are missings in current epc band, current sap rating or any of the survey attributes
|
||||
for c in (
|
||||
|
|
@ -2442,27 +2440,6 @@ def propsed_wave_3_sample():
|
|||
].sum()
|
||||
print("Total needing survey:", total_needing_survey)
|
||||
|
||||
# Look for postcodes that have no loss
|
||||
unselected_streets = street_summary[
|
||||
~street_summary["Selected"]
|
||||
]["Street and Region"].values
|
||||
|
||||
postcode_summary = results[
|
||||
results["Street and Region"].isin(unselected_streets)
|
||||
].pivot_table(
|
||||
index='Postcode',
|
||||
columns='Confidence Tier',
|
||||
aggfunc='size',
|
||||
fill_value=0
|
||||
).reset_index()
|
||||
|
||||
postcode_summary["Gain"] = postcode_summary[gain_columns].sum(axis=1)
|
||||
postcode_summary["Loss"] = postcode_summary[loss_columns].sum(axis=1)
|
||||
|
||||
no_loss_postcodes = postcode_summary[postcode_summary["Loss"] == 0].sort_values("Gain", ascending=False)
|
||||
total_bid_size = bid_size + no_loss_postcodes["Gain"].sum()
|
||||
print(total_bid_size)
|
||||
|
||||
# Label final outputs
|
||||
# We create a summary of packages by street
|
||||
results["Package Ref"] = results["Package Ref"].fillna("Incomplete")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue