access.Access.three_stage_fca¶
- Access.three_stage_fca(name='3sfca', cost=None, supply_values=None, max_cost=None, weight_fn=None, normalize=False)[source]¶
Calculate the three-stage floating catchment area access score.
- Parameters:
- namestr
Column name for access values
- coststr
Name of cost value column in cost_df (supply-side)
- max_costfloat
Cutoff of cost values
- weight_fnfunction
Weight to be applied to access values
- normalizebool
If True, return normalized access values; otherwise, return raw access values
- Returns:
- accesspandas Series
Accessibility score for origin locations.
Examples
Import the base Access class and Datasets.
>>> from access import Access, Datasets
Load each of the example datasets:
>>> chi_docs_dents = Datasets.load_data('chi_doc') >>> chi_population = Datasets.load_data('chi_pop') >>> chi_travel_costs = Datasets.load_data('chi_times')
>>> chi_docs_dents.head() geoid doc dentist 0 17031010100 1 1 1 17031010201 0 1 2 17031010202 4 1 3 17031010300 4 1 4 17031010400 0 2
>>> chi_population.head() geoid pop 0 17031010100 4854 1 17031010201 6450 2 17031010202 2818 3 17031010300 6236 4 17031010400 5042
>>> chi_travel_costs.head() origin dest cost 0 17093890101 17031010100 91.20 1 17093890101 17031010201 92.82 2 17093890101 17031010202 92.95 3 17093890101 17031010300 89.40 4 17093890101 17031010400 84.97
Using the example data, create an Access object.
>>> chicago_primary_care = Access(demand_df = chi_population, demand_index = "geoid", demand_value = "pop", supply_df = chi_docs_dents, supply_index = "geoid", supply_value = ["doc", "dentist"], cost_df = chi_travel_costs, cost_origin = "origin", cost_dest = "destination", cost_name = "cost")
>>> chicago_primary_care.three_stage_fca(name='3sfca') 3sfca_doc 3sfca_dentist geoid 17031010100 0.001424 0.000690 17031010201 0.001462 0.000785 17031010202 0.001411 0.000767 ........... ........ ........ 17197884101 0.000285 0.000380 17197884103 0.000404 0.000464 17197980100 0.000365 0.000407
The newly calculated 3sfca access measure is added to the access_df attribute of the Access object.
>>> chicago_primary_care.access_df.head() 3sfca_doc 3sfca_dentist geoid 17031010100 0.001447 0.000698 17031010201 0.001487 0.000795 17031010202 0.001420 0.000777 17031010300 0.001479 0.000742 17031010400 0.001274 0.000726