The n demand locations hit hardest by the change between set_a and set_b – naming names, rather than leaving a reader to infer “9,669 people worsened” affects somewhere in particular. population_impact_summary()/population_impact_phrase() give the region-wide total; this is the drill-down, built from the same per-region diff (return_per_region=True).
Parameters
Name
Type
Description
Default
n
int
Number of locations to return. If fewer than n locations fall in direction, all of them are returned (no error).
10
direction
(worsened, improved)
Which locations to rank. “worsened” (the default) answers “who is worst off?” – the question that matters most for a proposed closure. “improved” answers “who benefits most?”.
"worsened"
matrix
Passed straight through to population_impact_summary().
None
demand
Passed straight through to population_impact_summary().
None
meaningful_change_threshold
Passed straight through to population_impact_summary().
None
config_a
Passed straight through to population_impact_summary().
None
config_b
Passed straight through to population_impact_summary().
None
Returns
Name
Type
Description
pandas.DataFrame
Indexed by demand-location ID, ordered from most- to least- affected. Columns: Before, After, Change (signed – positive means longer/worse, negative means shorter/better), each suffixed with the travel matrix’s registered unit in parentheses (e.g. Before (minutes)) if one was registered; Previous site/New site – that location’s closest site under set_a/set_b respectively, so a “closed site X’s demand went to site Y” story can be read off a single row rather than cross-referencing site_reallocation_matrix() separately; and People affected (that location’s demand weight) if demand data is registered, else omitted.
Raises
Name
Type
Description
ValueError
If direction isn’t “worsened” or “improved”, or any of the errors population_impact_summary() raises.