Spaces:
Build error
Build error
fix: use cambridge onspd
Browse filesFormer-commit-id: aa5044428e4010d99ee25bee21e53727e88d7345 [formerly 0fdc9f62f95602fbeecc51da8b2a385b7f43cdc7]
Former-commit-id: ce3c53a3cd97142de87dab2d6b3534c1a38e7890
- planning_ai/document.py +26 -23
planning_ai/document.py
CHANGED
@@ -16,6 +16,23 @@ from planning_ai.common.utils import Paths
|
|
16 |
mpl.rcParams["text.usetex"] = True
|
17 |
mpl.rcParams["text.latex.preamble"] = r"\usepackage{libertine}"
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
def _process_postcodes(final):
|
21 |
documents = final["documents"]
|
@@ -25,10 +42,14 @@ def _process_postcodes(final):
|
|
25 |
.value_counts()
|
26 |
.with_columns(pl.col("postcode").str.replace_all(" ", ""))
|
27 |
)
|
28 |
-
onspd =
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
|
|
|
|
|
|
32 |
postcodes = postcodes.join(onspd, on="postcode")
|
33 |
return postcodes
|
34 |
|
@@ -219,25 +240,7 @@ def fig_wards(postcodes):
|
|
219 |
Paths.RAW / "Wards_December_2021_GB_BFE_2022_7523259277605796091.zip"
|
220 |
)
|
221 |
|
222 |
-
|
223 |
-
"E05013050",
|
224 |
-
"E05013051",
|
225 |
-
"E05013052",
|
226 |
-
"E05013053",
|
227 |
-
"E05013054",
|
228 |
-
"E05013055",
|
229 |
-
"E05013056",
|
230 |
-
"E05013057",
|
231 |
-
"E05013058",
|
232 |
-
"E05013059",
|
233 |
-
"E05013060",
|
234 |
-
"E05013061",
|
235 |
-
"E05013062",
|
236 |
-
"E05013063",
|
237 |
-
]
|
238 |
-
camb_ward_boundaries = ward_boundaries[
|
239 |
-
ward_boundaries["WD21CD"].isin(camb_ward_codes)
|
240 |
-
]
|
241 |
ward_boundaries_prop = ward_boundaries.merge(
|
242 |
postcodes.to_pandas(), left_on="WD21CD", right_on="OSWARD"
|
243 |
)
|
|
|
16 |
mpl.rcParams["text.usetex"] = True
|
17 |
mpl.rcParams["text.latex.preamble"] = r"\usepackage{libertine}"
|
18 |
|
19 |
+
WARDS = [
|
20 |
+
"E05013050",
|
21 |
+
"E05013051",
|
22 |
+
"E05013052",
|
23 |
+
"E05013053",
|
24 |
+
"E05013054",
|
25 |
+
"E05013055",
|
26 |
+
"E05013056",
|
27 |
+
"E05013057",
|
28 |
+
"E05013058",
|
29 |
+
"E05013059",
|
30 |
+
"E05013060",
|
31 |
+
"E05013061",
|
32 |
+
"E05013062",
|
33 |
+
"E05013063",
|
34 |
+
]
|
35 |
+
|
36 |
|
37 |
def _process_postcodes(final):
|
38 |
documents = final["documents"]
|
|
|
42 |
.value_counts()
|
43 |
.with_columns(pl.col("postcode").str.replace_all(" ", ""))
|
44 |
)
|
45 |
+
onspd = (
|
46 |
+
pl.read_parquet(
|
47 |
+
Paths.RAW / "onspd" / "onspd_cambridge.parquet",
|
48 |
+
columns=["PCD", "OSWARD", "LSOA11", "OA21"],
|
49 |
+
)
|
50 |
+
.with_columns(pl.col("PCD").str.replace_all(" ", "").alias("postcode"))
|
51 |
+
.filter(pl.col("OSWARD").is_in(WARDS))
|
52 |
+
)
|
53 |
postcodes = postcodes.join(onspd, on="postcode")
|
54 |
return postcodes
|
55 |
|
|
|
240 |
Paths.RAW / "Wards_December_2021_GB_BFE_2022_7523259277605796091.zip"
|
241 |
)
|
242 |
|
243 |
+
camb_ward_boundaries = ward_boundaries[ward_boundaries["WD21CD"].isin(WARDS)]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
ward_boundaries_prop = ward_boundaries.merge(
|
245 |
postcodes.to_pandas(), left_on="WD21CD", right_on="OSWARD"
|
246 |
)
|