Tax-Calculator IO#

Tax-Calculator IO

taxcalc.taxcalcio#

class taxcalc.taxcalcio.TaxCalcIO(input_data, tax_year, baseline, reform, assump, silent=True)[source]#

Constructor for the Tax-Calculator Input-Output class.

TaxCalcIO class constructor call must be followed by init() call.

Parameters:
  • 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.

  • silent (boolean) – whether or not to suppress action messages.

Returns:

class instance

Return type:

TaxCalcIO

analyze(output_params=False, output_tables=False, output_graphs=False, output_dump=False, dump_varlist=None)[source]#

Conduct tax analysis.

Parameters:
  • output_params (boolean) – whether or not to write baseline and reform policy parameter values to separate text files

  • 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

  • output_dump (boolean) – whether or not to write SQLite3 database with baseline and reform tables each containing the variables in dump_varlist.

  • dump_varlist (list) – list of variables to include in dumpdb output; list must include at least one variable.

Return type:

Nothing

output_filepath()[source]#

Return full path to output file named in TaxCalcIO constructor.

tax_year()[source]#

Return calendar year for which TaxCalcIO calculations are being done.

static write_decile_table(dfx, tfile, tkind='Totals')[source]#

Write to tfile the tkind decile table using dfx DataFrame.

static write_empty_graph_file(fname, title, reason)[source]#

Write HTML graph file with title but no graph for specified reason.

write_graph_files()[source]#

Write graphs to HTML files. All graphs contain same number of filing units in each quantile.

write_tables_file()[source]#

Write tables to text file.