Percentile matching#
The survey_enhance.percentile_match
module contains functions for matching the percentiles of two datasets.
- survey_enhance.percentile_match.match_percentiles(targets: Union[pandas.core.series.Series, microdf.generic.MicroSeries], sources: Union[pandas.core.series.Series, microdf.generic.MicroSeries], percentile_threshold: float = 0.95, num_groups: int = 10) pandas.core.series.Series [source]#
Match the percentiles of the source Series to the target Series.
- Parameters
targets – The Series to edit to match the source Series’s percentiles.
sources – The Series to match the percentiles to.
percentile_threshold – Don’t adjust data for percentiles below this threshold.
num_groups – The number of percentile groups to split the data into.
- Returns
A Series with the same index as target_df, but with the adjusted values.
- survey_enhance.percentile_match.match_percentiles_df(target_df: Union[pandas.core.frame.DataFrame, microdf.generic.MicroDataFrame], source_df: Union[pandas.core.frame.DataFrame, microdf.generic.MicroDataFrame], percentile_threshold: float = 0.95, num_groups: int = 10) pandas.core.frame.DataFrame [source]#
Match the percentiles of the source_df to the target_df.
- Parameters
target_df – The DataFrame to edit to match the source_df’s percentiles.
source_df – The DataFrame to match the percentiles to.
percentile_threshold – Don’t adjust data for percentiles below this threshold.
num_groups – The number of percentile groups to split the data into.
- Returns
A DataFrame with the same index as target_df, but with the adjusted values.