mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Merge pull request #353 from Hestia-Homes/etl-michael-fix
fix a bug with None not being caught by ValueError
This commit is contained in:
commit
0746cc7661
1 changed files with 7 additions and 7 deletions
|
|
@ -205,7 +205,7 @@ def get_wall_u_value(
|
|||
|
||||
mapped_value = wall_uvalues_df[
|
||||
wall_uvalues_df["Wall_type"] == mapped_description
|
||||
][age_band].values[0]
|
||||
][age_band].values[0]
|
||||
|
||||
if pd.isnull(mapped_value) and "Park home" in mapped_description:
|
||||
# We don't know enough in this case so we default to 0
|
||||
|
|
@ -257,7 +257,7 @@ def extract_thickness(thickness, is_roof_room, is_at_rafters, is_loft, is_flat):
|
|||
try:
|
||||
thickness = int(thickness)
|
||||
return thickness
|
||||
except ValueError:
|
||||
except (TypeError, ValueError):
|
||||
# If thickness is not a valid number (could be a string or None), return None
|
||||
return None
|
||||
|
||||
|
|
@ -350,7 +350,7 @@ def get_roof_u_value(
|
|||
is_roof_room=is_roof_room,
|
||||
is_at_rafters=is_at_rafters,
|
||||
is_loft=is_loft,
|
||||
is_flat=is_flat
|
||||
is_flat=is_flat,
|
||||
)
|
||||
|
||||
# Step 1: Try to get the U-value from table S9 based on the insulation thickness
|
||||
|
|
@ -395,9 +395,9 @@ def get_roof_u_value(
|
|||
# Get the U-value from table S10 based on the age band and the determined column
|
||||
if is_flat and thickness is not None:
|
||||
u_value = s10.loc[
|
||||
(s10["Insulation_Thickness"] == thickness) |
|
||||
s10["Age_band"].str.contains(age_band),
|
||||
column
|
||||
(s10["Insulation_Thickness"] == thickness)
|
||||
| s10["Age_band"].str.contains(age_band),
|
||||
column,
|
||||
].values.min()
|
||||
else:
|
||||
u_value = s10.loc[s10["Age_band"].str.contains(age_band), column].values[0]
|
||||
|
|
@ -560,7 +560,7 @@ def get_floor_u_value(
|
|||
insulation_lookup = s11[
|
||||
s11["Age_band"].str.contains(age_band) & s11["Floor_construction"]
|
||||
== floor_type
|
||||
]
|
||||
]
|
||||
if insulation_lookup.empty:
|
||||
insulation_thickness = 0
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue