Recipe1: Payroll Tax Calculation#
This recipe is to introduce how to calculate income & payroll tax liabilities from Taxcalc-Payroll.
To be noticed, most functions from Tax-Calculator can be called from Taxcalc-Payroll. Usages are the same for two models.
Package Import#
import taxcalcpayroll as tcp
Setup#
construct a Calculator object with Records and Policy#
recs = tcp.Records(data = 'puf.csv')
pol = tcp.Policy()
calc1 = tcp.Calculator(policy = pol, records = recs)
Calculate & Results#
Calculate income and payroll tax liabilites for the indicated year#
single year usage#
calc1.advance_to_year(2024)
calc1.calc_all()
print("Year 2024")
totiitax = calc1.weighted_total('iitax')
totpayroll = calc1.weighted_total('payrolltax')
print("total income tax revenue is: $", (totiitax/(10**9)).round(2), "Billion")
print("total payroll tax revenue is: $", (totpayroll/(10**9)).round(2), "Billion")
Year 2024
total income tax revenue is: $ 2204.23 Billion
total payroll tax revenue is: $ 1553.38 Billion
multi year usage#
# multi year usage
for cyr in range(2024,2034):
# advance to and calculate for specified cyr
calc1.advance_to_year(cyr)
calc1.calc_all()
print("Year ", cyr, ": total payroll tax revenue is ")
totpayroll = calc1.weighted_total('payrolltax')
print("$", (totpayroll/(10**9)).round(2), "Billions")
Year 2024 : total payroll tax revenue is $ 1553.38 Billions
Year 2025 : total payroll tax revenue is $ 1629.62 Billions
Year 2026 : total payroll tax revenue is $ 1703.17 Billions
Year 2027 : total payroll tax revenue is $ 1771.7 Billions
Year 2028 : total payroll tax revenue is $ 1841.91 Billions
Year 2029 : total payroll tax revenue is $ 1915.16 Billions
Year 2030 : total payroll tax revenue is $ 1990.95 Billions
Year 2031 : total payroll tax revenue is $ 2069.63 Billions
Year 2032 : total payroll tax revenue is $ 2151.42 Billions
Year 2033 : total payroll tax revenue is $ 2221.94 Billions