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