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
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
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()
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 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 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