UBICenter/us-calc

Use a for loop for repealing benefits

Opened this issue · 0 comments

To condense these if statements:

us-calc/funding.py

Lines 214 to 236 in 36e9e34

if 'ssi' in benefits:
funding += (target_persons.incssi * target_persons.asecwt).sum()
target_persons.new_spm_resources -= target_persons.incssi
if 'unemp' in benefits:
funding += (target_persons.incunemp * target_persons.asecwt).sum()
target_persons.new_spm_resources -= target_persons.incunemp
if 'eitc' in benefits:
funding += (target_persons.eitcred * target_persons.asecwt).sum()
target_persons.new_spm_resources -= target_persons.spmeitc
if 'ctc' in benefits:
funding += (target_persons.ctc * target_persons.asecwt).sum()
target_persons.new_spm_resources -= target_persons.spmctc
if 'snap' in benefits:
funding += (target_persons.snap_pp * target_persons.asecwt).sum()
target_persons.new_spm_resources -= target_persons.snap_pp
if 'energy' in benefits:
funding += (target_persons.energy_pp * target_persons.asecwt).sum()
target_persons.new_spm_resources -= target_persons.energy_pp