balance.weighting_methods.adjust_null

balance.weighting_methods.adjust_null.adjust_null(sample_df: DataFrame, sample_weights: Series, target_df: DataFrame, target_weights: Series, *args: object, **kwargs: object) dict[str, dict[str, str] | Series][source]

Doesn’t apply any adjustment to the data. Returns the design weights as they are. This may be useful when one needs the output of Sample.adjust() (i.e.: an adjusted object), but wishes to not run any model for it.

Parameters:
  • sample_df (pd.DataFrame) – a dataframe representing the sample

  • sample_weights (pd.Series) – design weights for sample

  • target_df (pd.DataFrame) – a dataframe representing the target

  • target_weights (pd.Series) – design weights for target

Returns:

Dict of weights (original sample weights) and model (with method = null_adjustment)

Return type:

Dict[str, Union[Dict[str, str], pd.Series]]

Examples: .. code-block:: python

import pandas as pd from balance.weighting_methods.adjust_null import adjust_null sample_df = pd.DataFrame({“x”: [0, 1]}) target_df = pd.DataFrame({“x”: [0, 1]}) weights = pd.Series([1.0, 2.0]) result = adjust_null(sample_df, weights, target_df, weights) result[“model”][“method”] # ‘null_adjustment’