The interface of GETTSIM#

This section provides the documentation of the two interface functions. If you want to have more information on how they work and how you can use them please see How-To Guides and Tutorials.

compute_taxes_and_transfers(data, params, functions, aggregation_specs=None, targets=None, columns_overriding_functions=None, check_minimal_specification='ignore', rounding=True, debug=False)[source]#

Compute taxes and transfers.

Parameters
  • data (pandas.Series or pandas.DataFrame or dict of pandas.Series) – Data provided by the user.

  • params (dict) – A dictionary with parameters from the policy environment. For more information see the documentation of the Parameter files.

  • functions (str, pathlib.Path, callable, module, imports statements, dict) – Functions from the policy environment. Functions can be anything of the specified types and a list of the same objects. If the object is a dictionary, the keys of the dictionary are used as a name instead of the function name. For all other objects, the name is inferred from the function name.

  • aggregation_specs (dict, default None) – A dictionary which contains specs for functions which aggregate variables on the tax unit or household level. The syntax is the same as for aggregation specs in the code base and as specified in [GEP 4](https://gettsim.readthedocs.io/en/stable/geps/gep-04.html).

  • targets (str, list of str, default None) – String or list of strings with names of functions whose output is actually needed by the user. By default, targets is None and all key outputs as defined by gettsim.config.DEFAULT_TARGETS are returned.

  • columns_overriding_functions (str list of str) – Names of columns in the data which are preferred over function defined in the tax and transfer system.

  • check_minimal_specification ({"ignore", "warn", "raise"}, default "ignore") – Indicator for whether checks which ensure the most minimal configuration should be silenced, emitted as warnings or errors.

  • rounding (bool, default True) – Indicator for whether rounding should be applied as specified in the law.

  • debug (bool) –

    The debug mode does the following:

    1. All necessary inputs and all computed variables are returned.

    2. If an exception occurs while computing one variable, the exception is skipped.

Returns

results (pandas.DataFrame) – DataFrame containing computed variables.

set_up_policy_environment(date)[source]#

Set up the policy environment for a particular date.

Parameters

date (int, str, datetime.date) – The date for which the policy system is set up.

Returns

  • params (dict) – A dictionary with parameters from the policy environment. For more information see the documentation of the Parameter files.

  • functions (dict) – Dictionary mapping column names to functions creating the respective data.