-
Notifications
You must be signed in to change notification settings - Fork 4
/
app3.py
40 lines (33 loc) · 1.46 KB
/
app3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""
app1.py illustrates use of pitaxcalc-demo release 2.0.0 (India version).
USAGE: python app2.py
"""
from taxcalc import *
# create Records object containing pit.csv and pit_weights.csv input data
recs = Records()
# create Records object containing pit.csv and pit_weights.csv input data
grecs = GSTRecords()
# create CorpRecords object containing cit.csv and cit_weights.csv input data
crecs = CorpRecords()
# create Policy object containing current-law policy
pol = Policy()
# specify Calculator object for current-law policy
calc1 = Calculator(policy=pol, records=recs, gstrecords=grecs,
corprecords=crecs, verbose=False)
# specify Calculator object for reform in JSON file
reform = Calculator.read_json_param_objects('app1_reform.json', None)
pol.implement_reform(reform['policy'])
calc2 = Calculator(policy=pol, records=recs, gstrecords=grecs,
corprecords=crecs, verbose=False)
# loop through years 2017, 2018, and 2019 and print out pitax
for year in range(2017, 2020):
calc1.advance_to_year(year)
calc2.advance_to_year(year)
calc1.calc_all()
calc2.calc_all()
weighted_tax1 = calc1.weighted_total('pitax')
weighted_tax2 = calc2.weighted_total('pitax')
total_weights = calc1.total_weight()
print(f'Tax 1 for {year}: {weighted_tax1 * 1e-9:,.2f}')
print(f'Tax 2 for {year}: {weighted_tax2 * 1e-9:,.2f}')
print(f'Total weight for {year}: {total_weights * 1e-6:,.2f}')