polaris.analyze.geo_mapping.CustomMapping#
- class polaris.analyze.geo_mapping.CustomMapping(popsyn_region_col: str, survey_region_col: str, location_to_popsyn: DataFrame, popsyn_to_survey: DataFrame)#
Bases:
GeoMappingStrategyCustom geographic mapping via user-provided DataFrames.
For non-US regions or custom geographic hierarchies.
- __init__(popsyn_region_col: str, survey_region_col: str, location_to_popsyn: DataFrame, popsyn_to_survey: DataFrame)#
Initialize with column names and pre-loaded mapping DataFrames.
- Args:
popsyn_region_col: Name of popsyn region column. survey_region_col: Name of survey region column. location_to_popsyn: DataFrame with columns [‘location’, popsyn_region_col]. popsyn_to_survey: DataFrame with columns [popsyn_region_col, survey_region_col].
Methods
__init__(popsyn_region_col, ...)Initialize with column names and pre-loaded mapping DataFrames.
get_popsyn_region(households)Map households (with 'location' column) to popsyn regions.
get_survey_region(households_with_popsyn)Map popsyn regions to survey regions.
Attributes
- __init__(popsyn_region_col: str, survey_region_col: str, location_to_popsyn: DataFrame, popsyn_to_survey: DataFrame)#
Initialize with column names and pre-loaded mapping DataFrames.
- Args:
popsyn_region_col: Name of popsyn region column. survey_region_col: Name of survey region column. location_to_popsyn: DataFrame with columns [‘location’, popsyn_region_col]. popsyn_to_survey: DataFrame with columns [popsyn_region_col, survey_region_col].
- popsyn_region_col: str#
- survey_region_col: str#
- get_popsyn_region(households: DataFrame) Series#
Map households (with ‘location’ column) to popsyn regions.
- get_survey_region(households_with_popsyn: DataFrame) Series#
Map popsyn regions to survey regions. Input must have popsyn_region_col.