def alleinerziehend_freib_tu_ab_2015(
    alleinerziehend_tu: BoolSeries,
    anz_kinder_tu: IntSeries,
    eink_st_abzuege_params: dict,
) -> FloatSeries:
    """Calculates tax deduction allowance for single parents since 2015.

    Since 2015, it increases with
    number of children. Used to be called 'Haushaltsfreibetrag'

    Parameters
    ----------
    alleinerziehend_tu
        See :func:`alleinerziehend_tu`.
    anz_kinder_tu
        See :func:`anz_kinder_tu`.
    eink_st_abzuege_params
        See params documentation :ref:`eink_st_abzuege_params <eink_st_abzuege_params>`.

    Returns
    -------

    """
    out = alleinerziehend_tu.astype(float) * 0
    out.loc[alleinerziehend_tu] = (
        eink_st_abzuege_params["alleinerziehenden_freibetrag"] +
        anz_kinder_tu.loc[alleinerziehend_tu] *
        eink_st_abzuege_params["alleinerziehenden_freibetrag_zusatz"])
    return out
Ejemplo n.º 2
0
def kindergeld_m_basis(tu_id: IntSeries, kindergeld_anspruch: BoolSeries,
                       kindergeld_params: dict) -> FloatSeries:
    """Calculate the preliminary kindergeld.

    Parameters
    ----------
    tu_id
        See basic input variable :ref:`tu_id <tu_id>`.
    kindergeld_anspruch
        See :func:`kindergeld_anspruch`.
    kindergeld_params
        See params documentation :ref:`kindergeld_params <kindergeld_params>`.

    Returns
    -------

    """
    # Kindergeld_Anspruch is the cumulative sum of eligible children.
    kumulativer_anspruch = ((
        kindergeld_anspruch.astype(int)).groupby(tu_id).transform("cumsum"))
    # Make sure that only eligible children get assigned kindergeld
    kumulativer_anspruch.loc[~kindergeld_anspruch] = 0
    out = kumulativer_anspruch.clip(upper=4).replace(
        kindergeld_params["kindergeld"])
    return out
Ejemplo n.º 3
0
def kinderzuschlag_eink_min(
    hh_id: IntSeries,
    kind: BoolSeries,
    alleinerziehend: BoolSeries,
    kinderzuschlag_params: dict,
) -> FloatSeries:
    """Calculate minimal claim of child benefit (kinderzuschlag).

    Min income to be eligible for KIZ (different for singles and couples) (§6a (1) Nr. 2
    BKGG).

    Parameters
    ----------
    hh_id
        See basic input variable :ref:`hh_id <hh_id>`.
    kind
        See basic input variable :ref:`kind <kind>`.
    alleinerziehend
        See basic input variable :ref:`alleinerziehend <alleinerziehend>`.
    kinderzuschlag_params
        See params documentation :ref:`kinderzuschlag_params <kinderzuschlag_params>`.

    Returns
    -------

    """
    hat_kinder_hh = kind.groupby(hh_id).transform("any")
    is_alleinerziehend_hh = alleinerziehend.groupby(hh_id).transform("all")

    conditions = [
        ~hat_kinder_hh, is_alleinerziehend_hh, ~is_alleinerziehend_hh
    ]
    choices = [
        0,
        kinderzuschlag_params["kinderzuschlag_min_eink_alleinerz"],
        kinderzuschlag_params["kinderzuschlag_min_eink_paare"],
    ]

    return pd.Series(index=hh_id.index, data=np.select(conditions, choices))
Ejemplo n.º 4
0
def anz_kinder_tu(tu_id: IntSeries, kind: BoolSeries) -> IntSeries:
    """Count children per tax unit.

    Parameters
    ----------
    tu_id
        See basic input variable :ref:`tu_id <tu_id>`.
    kind
        See basic input variable :ref:`kind <kind>`.
    Returns
    -------
    IntSeries with the number of children per tax unit.
    """
    return (kind.astype(int)).groupby(tu_id).sum()
Ejemplo n.º 5
0
def kinder_in_hh(kind: BoolSeries, hh_id: IntSeries) -> BoolSeries:
    """Check if children are in household.

    Parameters
    ----------
    kind
        See basic input variable :ref:`kind <kind>`.
    hh_id
        See basic input variable :ref:`hh_id <hh_id>`.

    Returns
    -------
    BoolSeries indicating children in household.
    """
    return kind.groupby(hh_id).any()
Ejemplo n.º 6
0
def alleinerziehend_tu(tu_id: IntSeries,
                       alleinerziehend: BoolSeries) -> BoolSeries:
    """Check if single parent is in tax unit.

    Parameters
    ----------
    tu_id
        See basic input variable :ref:`tu_id <tu_id>`.
    alleinerziehend
        See basic input variable :ref:`alleinerziehend <alleinerziehend>`.
    Returns
    -------
    BoolSeries indicating single parent in tax unit.
    """
    return alleinerziehend.groupby(tu_id).any()
Ejemplo n.º 7
0
def rentner_in_hh(hh_id: IntSeries, rentner: BoolSeries) -> BoolSeries:
    """Check if pensioner is in household.

    Parameters
    ----------
    hh_id
        See basic input variable :ref:`hh_id <hh_id>`.
    rentner
        See basic input variable :ref:`rentner <rentner>`.

    Returns
    -------
    BoolSeries indicating pensioner in household.
    """
    return rentner.groupby(hh_id).any()
Ejemplo n.º 8
0
def anz_kinder_hh(hh_id: IntSeries, kind: BoolSeries) -> IntSeries:
    """Count children in households.

    Parameters
    ----------
    hh_id
        See basic input variable :ref:`hh_id <hh_id>`.
    kind
        See basic input variable :ref:`kind <kind>`.

    Returns
    -------
    IntSeries with the number of children per household.
    """
    return kind.astype(int).groupby(hh_id).sum()
def anz_kindergeld_kinder_tu(tu_id: IntSeries,
                             kindergeld_anspruch: BoolSeries) -> FloatSeries:
    """Count number of children eligible for Child Benefit.

    Parameters
    ----------
    tu_id
        See basic input variable :ref:`tu_id <tu_id>`.
    kindergeld_anspruch
        See :func:`kindergeld_anspruch`.

    Returns
    -------

    """
    return kindergeld_anspruch.groupby(tu_id).sum()
Ejemplo n.º 10
0
def anz_kinder_anspruch_per_hh(hh_id: IntSeries,
                               kindergeld_anspruch: BoolSeries) -> IntSeries:
    """Count number of children eligible to child benefit (§6a (1) Nr. 1 BKGG)kdu.

    Parameters
    ----------
    hh_id
        See basic input variable :ref:`hh_id <hh_id>`.
    kindergeld_anspruch
        See :func:`kindergeld_anspruch`.

    Returns
    -------

    """
    return kindergeld_anspruch.groupby(hh_id).transform("sum")
Ejemplo n.º 11
0
def alleinerziehend_hh(hh_id: IntSeries,
                       alleinerziehend: BoolSeries) -> BoolSeries:
    """Check if single parent is in household.

    Parameters
    ----------
    hh_id : IntSeries
        See basic input variable :ref:`hh_id <hh_id>`.
    alleinerziehend : BoolSeries
        See basic input variable :ref:`alleinerziehend <alleinerziehend>`.

    Returns
    -------
    BoolSeries indicating single parent in household.
    """
    return alleinerziehend.groupby(hh_id).any()
Ejemplo n.º 12
0
def gemeinsam_veranlagte_tu(tu_id: IntSeries,
                            gemeinsam_veranlagt: BoolSeries) -> BoolSeries:
    """Check for each tax unit if it consists of two wage earners.

    Parameters
    ----------
    gemeinsam_veranlagt
        Return of :func:`gemeinsam_veranlagt`.
    tu_id
        See basic input variable :ref:`tu_id <tu_id>`.

    Returns
    -------
    BoolSeries indicating for each tax unit two wage earners.
    """
    return gemeinsam_veranlagt.groupby(tu_id).any()
def sonderausgaben_bis_2011(kind: BoolSeries,
                            eink_st_abzuege_params: dict) -> FloatSeries:
    """Calculating sonderausgaben for childcare until 2011.

    There is only a lumpsum payment implemented.
    Parameters
    ----------
    kind
        See basic input variable :ref:`kind <kind>`.
    eink_st_abzuege_params
        See params documentation :ref:`eink_st_abzuege_params <eink_st_abzuege_params>`.

    Returns
    -------

    """
    out = kind.astype(float) * 0
    out.loc[~kind] = eink_st_abzuege_params["sonderausgabenpauschbetrag"]
    return out
def rentenwert(wohnort_ost: BoolSeries,
               ges_renten_vers_params: dict) -> FloatSeries:
    """Select the rentenwert depending on place of living.

    Parameters
    ----------
    wohnort_ost
        See basic input variable :ref:`wohnort_ost <wohnort_ost>`.
    ges_renten_vers_params
        See params documentation :ref:`ges_renten_vers_params <ges_renten_vers_params>`.

    Returns
    -------

    """
    out = wohnort_ost.replace({
        True: ges_renten_vers_params["rentenwert_west"],
        False: ges_renten_vers_params["rentenwert_west"],
    }).astype(float)
    return out
Ejemplo n.º 15
0
def rentenv_beitr_bemess_grenze(wohnort_ost: BoolSeries,
                                soz_vers_beitr_params: dict) -> FloatSeries:
    """Calculating the income threshold up to which pension insurance payments apply.

    Parameters
    ----------
    wohnort_ost
    soz_vers_beitr_params

    Returns
    -------

    """
    out = wohnort_ost.replace({
        True:
        soz_vers_beitr_params["beitr_bemess_grenze"]["rentenv"]["ost"],
        False:
        soz_vers_beitr_params["beitr_bemess_grenze"]["rentenv"]["west"],
    })
    return out.astype(float)
Ejemplo n.º 16
0
def mini_job_grenze(wohnort_ost: BoolSeries, soz_vers_beitr_params: dict):
    """Select the income threshold depending on place of living

    Parameters
    ----------
    wohnort_ost
        See basic input variable :ref:`wohnort_ost <wohnort_ost>`.
    soz_vers_beitr_params
        See params documentation :ref:`soz_vers_beitr_params <soz_vers_beitr_params>`.
    Returns
    -------

    """
    out = wohnort_ost.replace({
        True:
        soz_vers_beitr_params["geringfügige_eink_grenzen"]["mini_job"]["ost"],
        False:
        soz_vers_beitr_params["geringfügige_eink_grenzen"]["mini_job"]["west"],
    })

    return out.astype(float)
def alleinerziehend_freib_tu_bis_2014(
        alleinerziehend_tu: BoolSeries,
        eink_st_abzuege_params: dict) -> FloatSeries:
    """Calculates tax deduction allowance for single parents until 2014.

    This used to be called 'Haushaltsfreibetrag'.

    Parameters
    ----------
    alleinerziehend_tu
        See :func:`alleinerziehend_tu`.
    eink_st_abzuege_params
        See params documentation :ref:`eink_st_abzuege_params <eink_st_abzuege_params>`.

    Returns
    -------

    """
    out = alleinerziehend_tu.astype(float) * 0
    out.loc[alleinerziehend_tu] = eink_st_abzuege_params[
        "alleinerziehenden_freibetrag"]
    return out
def sonderausgaben_ab_2012(
    betreuungskost_m: FloatSeries,
    tu_id: IntSeries,
    kind: BoolSeries,
    anz_erwachsene_tu: IntSeries,
    eink_st_abzuege_params: dict,
) -> FloatSeries:
    """Calculate sonderausgaben for childcare since 2012.

    We follow 10 Abs.1 Nr. 5 EStG. You can
    details here https://www.buzer.de/s1.htm?a=10&g=estg.
    Parameters
    ----------
    betreuungskost_m
        See basic input variable :ref:`betreuungskost_m <betreuungskost_m>`.
    tu_id
        See basic input variable :ref:`tu_id <tu_id>`.
    kind
        See basic input variable :ref:`kind <kind>`.
    eink_st_abzuege_params
        See params documentation :ref:`eink_st_abzuege_params <eink_st_abzuege_params>`.
    anz_erwachsene_tu
        See :func:`anz_erwachsene_tu`.

    Returns
    -------

    """
    erwachsene_in_tu = tu_id.replace(anz_erwachsene_tu)
    abziehbare_betreuungskosten = (12 * betreuungskost_m).clip(
        upper=eink_st_abzuege_params["kinderbetreuungskosten_abz_maximum"])

    berechtigte_kinder = kind.groupby(tu_id).transform(sum)
    out = (berechtigte_kinder * abziehbare_betreuungskosten *
           eink_st_abzuege_params["kinderbetreuungskosten_abz_anteil"]
           ) / erwachsene_in_tu

    out.loc[kind] = 0
    return out
Ejemplo n.º 19
0
def bezugsgröße(wohnort_ost: BoolSeries,
                soz_vers_beitr_params: dict) -> FloatSeries:
    """Threshold for self employment income subject to health insurance.

    Selecting by place of living the income threshold for self employed up to which the
    rate of health insurance contributions apply.

    Parameters
    ----------
    wohnort_ost
        See basic input variable :ref:`wohnort_ost <wohnort_ost>`.
    soz_vers_beitr_params
        See params documentation :ref:`soz_vers_beitr_params <soz_vers_beitr_params>`.

    Returns
    -------
    """
    return wohnort_ost.replace({
        True:
        soz_vers_beitr_params["bezugsgröße"]["ost"],
        False:
        soz_vers_beitr_params["bezugsgröße"]["west"],
    }).astype(float)
Ejemplo n.º 20
0
def krankenv_beitr_bemess_grenze(wohnort_ost: BoolSeries,
                                 soz_vers_beitr_params: dict) -> FloatSeries:
    """Calculating the income threshold up to which health insurance payments apply.

    Parameters
    ----------
    wohnort_ost
        See :func:`wohnort_ost`.
    soz_vers_beitr_params
        See params documentation :ref:`soz_vers_beitr_params <soz_vers_beitr_params>`.

    Returns
    -------
    Pandas Series containing the income threshold up to which the rate of health
    insurance contributions apply.

    """
    out = wohnort_ost.replace({
        True:
        soz_vers_beitr_params["beitr_bemess_grenze"]["ges_krankenv"]["ost"],
        False:
        soz_vers_beitr_params["beitr_bemess_grenze"]["ges_krankenv"]["west"],
    })
    return out.astype(float)