Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import dropq
- import pandas as pd
- import taxcalc
- import json
- first_year = 2016
- myvars = {'_BE_sub':[0.4], '_STD_Aged': [[0, 0, 0, 0, 1550, 1250]], '_CTC_additional': [2500.0], '_II_credit': [[2000, 4000, 2000, 3000]], '_II_rt1': [0.0], '_II_rt3': [0.0], '_II_rt2': [0.0], '_II_credit_ps': [[150000, 300000, 150000, 200000]], '_II_rt4': [0.0], '_ID_StateLocalTax_HC': [1.0], '_II_rt6': [0.25], '_NIIT_trt': [0.0], '_II_rt5': [0.15], '_CG_rt3': [0.0], '_CG_rt2': [0.0], '_II_rt7': [0.35], '_ID_Miscellaneous_frt': [5.0], '_ID_BenefitSurtax_Switch': [[True, True, True, True, True, True, True]], '_ID_Medical_frt': [5.0], '_ID_Casualty_frt': [5.0], '_BE_CG_per': [0.78], '_ID_RealEstate_HC': [1.0], '_AMT_trt1': [0.0], '_AMT_trt2': [0.0], '_STD': [[0, 0, 0, 0, 12600, 6300, 1050]], '_II_credit_prt': [0.04], '_II_brk5': [[75000, 150000, 75000, 100000, 413350, 206675]], '_II_brk4': [[0, 0, 0, 0, 231450, 115725]], '_II_brk6': [[150000, 300000, 150000, 200000, 466950, 233475]], '_II_brk1': [[0, 0, 0, 0, 18550, 9275]], '_II_brk3': [[0, 0, 0, 0, 151900, 75950]], '_II_brk2': [[0, 0, 0, 0, 75300, 37650]]}
- user_mods = {first_year: myvars}
- #Create a Public Use File object
- tax_dta = pd.read_csv("puf.csv.gz", compression='gzip')
- mY_dec, mX_dec, df_dec, pdf_dec, cdf_dec, mY_bin, mX_bin, df_bin, pdf_bin, cdf_bin, fiscal_tots = dropq.run_models(tax_dta, num_years=3, start_year=first_year, user_mods=user_mods)
- with open("mY_dec2be.txt", "w") as f1:
- f1.write(json.dumps(mY_dec, sort_keys=True, indent=4, separators=(',', ': ')) + '\n')
- with open("mX_dec2be.txt", "w") as f1:
- f1.write(json.dumps(mX_dec, sort_keys=True, indent=4, separators=(',', ': ')) + '\n')
- with open("df_dec2be.txt", "w") as f1:
- f1.write(json.dumps(df_dec, sort_keys=True, indent=4, separators=(',', ': ')) + '\n')
- with open("pdf_dec2be.txt", "w") as f1:
- f1.write(json.dumps(pdf_dec, sort_keys=True, indent=4, separators=(',', ': ')) + '\n')
- with open("cdf_dec2be.txt", "w") as f1:
- f1.write(json.dumps(cdf_dec, sort_keys=True, indent=4, separators=(',', ': ')) + '\n')
- with open("mY_bin2be.txt", "w") as f1:
- f1.write(json.dumps(mY_bin, sort_keys=True, indent=4, separators=(',', ': ')) + '\n')
- with open("mX_bin2be.txt", "w") as f1:
- f1.write(json.dumps(mX_bin, sort_keys=True, indent=4, separators=(',', ': ')) + '\n')
- with open("df_bin2be.txt", "w") as f1:
- f1.write(json.dumps(df_bin, sort_keys=True, indent=4, separators=(',', ': ')) + '\n')
- with open("pdf_bin2be.txt", "w") as f1:
- f1.write(json.dumps(pdf_bin, sort_keys=True, indent=4, separators=(',', ': ')) + '\n')
- with open("cdf_bin2be.txt", "w") as f1:
- f1.write(json.dumps(cdf_bin, sort_keys=True, indent=4, separators=(',', ': ')) + '\n')
- with open("fiscal_tots2be.txt", "w") as f1:
- f1.write(json.dumps(fiscal_tots, sort_keys=True, indent=4, separators=(',', ': ')) + '\n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement