ssbkonf.perturb — ssbkonf 0.0.6 documentation

# `ssbkonf.perturb`

## Module Contents

### Functions

`small_count_rounding`(→ pandas.DataFrame) | Function for applying the small count rouding method to frequency tables

### Attributes

`__scr` |

ssbkonf.perturb.__scr

ssbkonf.perturb.small_count_rounding(data: pandas.DataFrame, hierarchies: dict[str, pandas.DataFrame | list[pandas.DataFrame]] = None, formula: str = None, freq_var: str = 'freq', round_base: int = 3, max_round=None, force_inner=False, all_small=False, max_iter_rows=1000) → pandas.DataFrame

  Function for applying the small count rouding method to frequency tables

  Args:

    - data (DataFrame): A DataFrame containing the input data, either as frequency data in long format or as microdata.

    - hierarchies (dict[str, DataFrame | list[DataFrame]], optional): A dictionary containing hierarchies. Each key is a variable name, each value is a list of pandas.DataFrames describing the hierarchies associated with the key. Defaults to None.

    - formula (str, optional): An R model formula, written as a string, for table definition. Defaults to None.. Defaults to None.

    - freq_var (str, optional): Name of the variable containing frequency information. Defaults to “freq”.

    - round_base (int, optional): Base to be used for rounding. Defaults to 3.

    - max_round (int, optional): Inner cells contributing to original publishable cells equal to or less than max_round will be rounded.

    - If None, value is set to round_base - 1. Defaults to None.

    - force_inner (bool, optional): When True, all inner cells are rounded. Defaults to False.

    - all_small (bool, optional): When True, all small (<= max_round) inner cells are rounded. Defaults to False.

    - max_iter_rows (int, optional): Maximum number of iterations. Defaults to 1000.

  Returns:

    pandas.DataFrame