area_data
Functions to retrieve data that are specific to areas and relevant to all indicators. For example: Deprivation decile.
- fingertips_py.area_data.defined_qcut(df, value_series, number_of_bins, bins_for_extras, labels=False)
Allows users to define how values are split into bins when clustering.
- Parameters:
df – Dataframe of values
value_series – Name of value column to rank upon
number_of_bins – Integer of number of bins to create
bins_for_extras – Ordered list of bin numbers to assign uneven splits
labels – Optional. Labels for bins if required
- Returns:
A dataframe with a new column ‘bins’ which contains the cluster numbers
- fingertips_py.area_data.deprivation_decile(area_type_id, year='2015', area_code=None)
Takes in an area type id and returns a pandas series of deprivation deciles for those areas (with the areas as an index. If a specific area is requested, it returns just the deprivation decile value.
- Parameters:
area_type_id – Area type id as denoted by the Fingertips API
year – Year of deprivation score
area_code – Optional. Area code for area type to return a single value for that area
- Returns:
A pandas series of deprivation scores with area codes as the index. Or single value if area is specified.