@@ -67,8 +67,12 @@ same way (at a higher token cost).
6767
6868``` {code-cell} python
6969blocks = close.blocks_query(
70- center = {"lon": city["lon"], "lat": city["lat"]}, radius_m = 2500,
71- mode = "walk", type = list(basket.values()), include_population = True)
70+ center = {"lon": city["lon"], "lat": city["lat"]},
71+ radius_m = 2500,
72+ mode = "walk",
73+ type = list(basket.values()),
74+ include_population = True
75+ )
7276
7377one_per_block = blocks.drop_duplicates("geoid").reset_index(drop = True)
7478total_pop = one_per_block["population"].sum()
@@ -94,8 +98,12 @@ highlighted, the city boundary behind.
9498near_library = set(blocks.loc[(blocks.dest_type_id == basket["library"]) &
9599 (blocks.travel_time <= 15), "geoid"])
96100one_per_block["has_library"] = one_per_block.geoid.isin(near_library)
97- close_map(one_per_block, highlight = "has_library", color = "#058040",
98- boundary = city_boundary)
101+ close_map(
102+ one_per_block,
103+ highlight = "has_library",
104+ color = "#058040",
105+ boundary = city_boundary
106+ )
99107```
100108
101109## The 15-minute-city score
@@ -127,8 +135,12 @@ basket_pop = one_per_block.loc[one_per_block.geoid.isin(covered_all),
127135print(f"All six amenities: {100 * basket_pop / total_pop:.0f}% of residents")
128136
129137one_per_block["full_basket"] = one_per_block.geoid.isin(covered_all)
130- close_map(one_per_block, highlight = "full_basket", color = "#f36e21",
131- boundary = city_boundary)
138+ close_map(
139+ one_per_block,
140+ highlight = "full_basket",
141+ color = "#f36e21",
142+ boundary = city_boundary
143+ )
132144```
133145
134146## Which amenity to add first
@@ -170,8 +182,10 @@ gap = np.array([" + ".join(n for n, m in zip(names, row) if m) for row in missin
170182
171183almost = np.isin(n_missing, [1, 2])
172184almost_pop = pops[almost].sum()
173- print(f"{100 * almost_pop / total_pop:.0f}% of residents are one or two amenities "
174- f"short of the full basket.\n")
185+ print(
186+ f"{100 * almost_pop / total_pop:.0f}% of residents are one or two amenities "
187+ f"short of the full basket.\n"
188+ )
175189
176190by_gap = (pd.Series(pops[almost], index = gap[almost])
177191 .groupby(level = 0).sum().sort_values(ascending = False))
@@ -188,8 +202,14 @@ isochrone gives exactly the blocks that could reach the site on foot in 15 minut
188202
189203``` {code-cell} python
190204site_lon, site_lat = -77.437, 37.548
191- reachable = close.isochrone(lon = site_lon, lat = site_lat, mode = "walk",
192- direction = "to", minutes = 15, format = "blocks")
205+ reachable = close.isochrone(
206+ lon = site_lon,
207+ lat = site_lat,
208+ mode = "walk",
209+ direction = "to",
210+ minutes = 15,
211+ format = "blocks"
212+ )
193213
194214near_supermarket = set(blocks.loc[(blocks.dest_type_id == basket["supermarket"]) &
195215 (blocks.travel_time <= 15), "geoid"])
@@ -203,6 +223,10 @@ Map the whole city and highlight the blocks that would newly gain access.
203223
204224``` {code-cell} python
205225one_per_block["newly_served"] = one_per_block.geoid.isin(newly_served)
206- close_map(one_per_block, highlight = "newly_served", color = "#e8590c",
207- boundary = city_boundary)
226+ close_map(
227+ one_per_block,
228+ highlight = "newly_served",
229+ color = "#e8590c",
230+ boundary = city_boundary
231+ )
208232```
0 commit comments