Tax-Brain Class Object¶
taxbrain
taxbrain.taxbrain¶
-
class
taxbrain.taxbrain.
TaxBrain
(start_year: int, end_year: int = 2031, microdata: Optional[Union[str, dict]] = None, use_cps: bool = False, reform: Optional[Union[str, dict]] = None, behavior: Optional[dict] = None, assump=None, base_policy: Optional[Union[str, dict]] = None, verbose=False, stacked=False)[source]¶ -
differences_table
(year: int, groupby: str, tax_to_diff: str, pop_quantiles: bool = False) → pandas.core.frame.DataFrame[source]¶ Method to create a differences table
- Parameters
year (int) – which year the difference table should be from
groupby (str) – determines how the rows in the table are sorted options: ‘weighted_deciles’, ‘standard_income_bins’, ‘soi_agi_bin’
tax_to_diff (str) – which tax to take the difference of options: ‘iitax’, ‘payrolltax’, ‘combined’
pop_quantiles (bool) – whether weighted_deciles contain an equal number of tax units (False) or people (True)
- Returns
table – differences table
- Return type
Pandas DataFrame
-
distribution_table
(year: int, groupby: str, income_measure: str, calc: str, pop_quantiles: bool = False) → pandas.core.frame.DataFrame[source]¶ Method to create a distribution table
- Parameters
year (int) – which year the distribution table data should be from
groupby (str) – determines how the rows in the table are sorted options: ‘weighted_deciles’, ‘standard_income_bins’, ‘soi_agi_bin’
income_measure (str) – determines which variable is used to sort the rows in the table options: ‘expanded_income’ or ‘expanded_income_baseline’
calc (which calculator to use: base or reform) – which calculator to use, can take either ‘REFORM’ or ‘BASE’
calc –
pop_quantiles (bool) – whether or not weighted_deciles contain equal number of tax units (False) or people (True)
- Returns
table – distribution table
- Return type
Pandas DataFrame
-
multi_var_table
(varlist: list, calc: str, include_total: bool = False) → pandas.core.frame.DataFrame[source]¶ Create a Pandas DataFrame with multiple variables from the specified data source
- Parameters
varlist (list) – list of variables to include in the table
calc (str) – specify reform or base calculator data, can take either ‘REFORM’ or ‘BASE’
include_total (bool) – If true the returned DataFrame will include a “total” column
- Returns
df – A Pandas DataFrame containing the weighted sum of each variable passed in the varlist argument for each year in the analysis.
- Return type
Pandas DataFrame
-
run
(varlist: list = ['expanded_income', 'ubi', 'refund', 'c62100', 'c05800', 's006', 'othertaxes', 'c07100', 'surtax', 'benefit_value_total', 'iitax', 'c00100', 'XTOT', 'benefit_cost_total', 'c04470', 'c04800', 'standard', 'aftertax_income', 'payrolltax', 'c09600', 'taxbc', 'combined', 'c04600'], client=None, num_workers=1)[source]¶ Run the calculators. TaxBrain will determine whether to do a static or partial equilibrium run based on the user’s inputs when initializing the TaxBrain object.
- Parameters
varlist (list) – variables from the microdata to be stored in each year
- Returns
- Return type
None
-
weighted_totals
(var: str, include_total: bool = False) → pandas.core.frame.DataFrame[source]¶ Create a pandas DataFrame that shows the weighted sum or a specified variable under the baseline policy, reform policy, and the difference between the two.
- Parameters
var (str) – Variable name for variable you want the weighted total of.
include_total (bool) – If true the returned DataFrame will include a “total” columns
- Returns
A Pandas DataFrame with rows for the baseline total, reform total, and the difference between the two.
- Return type
Pandas DataFrame
-