Skip to content

Commit

Permalink
Merge pull request #85 from nestauk/84_bugfix_avg_garden
Browse files Browse the repository at this point in the history
BUGFIX avg garden size
  • Loading branch information
crispy-wonton authored Jan 8, 2025
2 parents c98b533 + c349b1a commit a6c6c23
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions asf_heat_pump_suitability/pipeline/prepare_features/epc.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ def add_col_msoa_avg_outdoor_space_property_type(
Returns:
pl.DataFrame: EPC dataset with secondary property type mapped from ONS garden size dataset
"""
houses = ["Detached", "Semi-Detached", "Terraced (including end-terrace)"]

df = df.with_columns(
pl.when(pl.col(ptype_col).str.to_lowercase().str.contains("house"))
pl.when(pl.col(ptype_col).is_in(houses))
.then(pl.lit("Houses"))
.when(pl.col(ptype_col).str.to_lowercase().str.contains("flat"))
.then(pl.lit("Flats"))
.otherwise(pl.lit(ptype_col))
.otherwise(pl.lit("unknown"))
.alias("msoa_avg_outdoor_space_property_type")
)

Expand Down

0 comments on commit a6c6c23

Please sign in to comment.