- class taxcalc.taxcalcio.TaxCalcIO(input_data, tax_year, baseline, reform, assump, outdir=None)#
Constructor for the Tax-Calculator Input-Output class.
TaxCalcIO class constructor call must be followed by init() call.
input_data (string or Pandas DataFrame) – string is name of INPUT file that is CSV formatted containing variable names in the Records USABLE_READ_VARS set, or Pandas DataFrame is INPUT data containing variable names in the Records USABLE_READ_VARS set. INPUT vsrisbles not in the Records USABLE_READ_VARS set can be present but are ignored.
tax_year (integer) – calendar year for which taxes will be computed for INPUT.
baseline (None or string) – None implies baseline policy is current-law policy, or string is name of optional BASELINE file that is a JSON reform file.
reform (None or string) – None implies no policy reform (current-law policy), or string is name of optional REFORM file(s).
assump (None or string) – None implies economic assumptions are standard assumptions, or string is name of optional ASSUMP file.
outdir (None or string) – None implies output files written to current directory, or string is name of optional output directory
- Return type:
- analyze(writing_output_file=False, output_tables=False, output_graphs=False, dump_varset=None, output_dump=False, output_sqldb=False)#
Conduct tax analysis.
writing_output_file (boolean) – whether or not to generate and write output file
output_tables (boolean) – whether or not to generate and write distributional tables to a text file
output_graphs (boolean) – whether or not to generate and write HTML graphs of average and marginal tax rates by income percentile
dump_varset (set) – custom set of variables to include in dump and sqldb output; None implies include all variables in dump and sqldb output
output_dump (boolean) – whether or not to replace standard output with all input and calculated variables using their Tax-Calculator names
output_sqldb (boolean) – whether or not to write SQLite3 database with dump table containing same output as written by output_dump to a csv file
- Return type:
Return set of variable names extracted from tcdumpvars_str, which contains the contents of the tcdumpvars file in the current directory. Also, builds self.errmsg if any custom variables are not valid.
- dump_output(dump_varset, mtr_inctax, mtr_paytax)#
Extract dump output and return it as Pandas DataFrame.
Extract minimal output and return it as Pandas DataFrame.
Return full path to output file named in TaxCalcIO constructor.
Return calendar year for which TaxCalcIO calculations are being done.
- static write_decile_table(dfx, tfile, tkind='Totals')#
Write to tfile the tkind decile table using dfx DataFrame.
Write reform documentation to text file.
- static write_empty_graph_file(fname, title, reason)#
Write HTML graph file with title but no graph for specified reason.
Write graphs to HTML files. All graphs contain same number of filing units in each quantile.
- write_output_file(output_dump, dump_varset, mtr_paytax, mtr_inctax)#
Write output to CSV-formatted file.
- write_sqldb_file(dump_varset, mtr_paytax, mtr_inctax)#
Write dump output to SQLite3 database table dump.
Write tables to text file.