access.Access.score

Access.score(col_dict, name='score')[source]

Weighted aggregate of multiple already-calculated, normalized access components.

Parameters:
namestr

Column name for access values

col_dictdict

Column names (keys) and weights.

Returns:
accesspandas Series

Single, aggregate score for origin locations.

Examples

Import the base Access class and Datasets.

>>> from access import Access, Datasets

Load each of the example datasets which correspond to the demand (population), supply (doctors and dentists) and cost (travel time), respectively. The sample data represents the Chicago metro area with a 50km buffer around the city boundaries.

>>> 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

The chi_travel_costs dataset is the cost matrix, showing the travel time between each of the Census Tracts in the Chicago metro area.

>>> 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

Now, create an instance of the Access class and specify the demand, supply, and cost datasets.

>>> 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 = "dest", cost_name = "cost")

With the demand, supply, and cost data provided, we can now produce the RAAM access measures defining a floating catchment area of 30 minutes by setting the tau value to 30 (60 minutes is the default).

>>> chicago_primary_care.raam(tau = 30)
             raam_doc  raam_dentist
geoid
17031010100  1.027597      1.137901
17031010201  0.940239      1.332557
17031010202  1.031144      1.413279
...........  ........      ........
17197884101  2.365171      1.758800
17197884103  2.244007      1.709857
17197980100  2.225820      1.778264

Aggregate RAAM for doctors and dentists, weighting doctors more heavily.

>>> chicago_primary_care.score(name = "raam_combo", col_dict = {"raam_doc" : 0.8, "raam_dentist" : 0.2})
geoid
17031010100    0.786697
17031010201    0.765081
17031010202    0.831578
...........    ........
17197884101    1.677075
17197884103    1.597554
17197980100    1.597386