This commit is contained in:
Andras Schmelczer 2026-07-12 15:03:33 +01:00
parent 982e0cc89c
commit cfaf58dfba
44 changed files with 793 additions and 201 deletions

View file

@ -73,7 +73,7 @@ def _remap_terminated_postcodes(
def _dedupe_collapsed_properties(wide: pl.LazyFrame) -> pl.LazyFrame:
"""Keep one row per (postcode, address) the most-recent transaction.
"""Keep one row per (postcode, address): the most-recent transaction.
The terminated-postcode remap can map two distinct postcodes onto one active
successor, collapsing the same physical address onto a single
@ -87,7 +87,7 @@ def _dedupe_collapsed_properties(wide: pl.LazyFrame) -> pl.LazyFrame:
(postcode, null) key and silently drop all but one. Each dwelling's coalesced
address is unique within its postcode (the EPC frame is deduped on
address+postcode upstream), so the coalesced key keeps them distinct while
leaving sold-property dedup unchanged pp_address wins the coalesce whenever
leaving sold-property dedup unchanged, since pp_address wins the coalesce whenever
a sale exists.
"""
return (
@ -153,7 +153,7 @@ def build_postcode_centroids(arcgis_path: Path) -> pl.LazyFrame:
This is the lat/lon source price estimation needs (index sector centroids,
kNN). It is the same per-postcode lat/lon merge writes into postcode.parquet
(both come from arcgis), but built straight from arcgis so the index/estimate
steps do not depend on the merge output adding an area column to merge
steps do not depend on the merge output. Adding an area column to merge
therefore does not invalidate the expensive price index/kNN.
"""
return _active_english_postcode_area(pl.scan_parquet(arcgis_path)).select(