Skip to content

Commit

Permalink
Merge pull request #1152 from MattHJensen/10_min_fixes
Browse files Browse the repository at this point in the history
10 min fixes
  • Loading branch information
MattHJensen committed Jan 24, 2017
2 parents 466e2be + 8df6800 commit 226a53e
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 31 deletions.
77 changes: 47 additions & 30 deletions docs/notebooks/10_Minutes_to_Tax-Calculator.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# How to use the Tax Calculator"
"# How to use Tax-Calculator"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This guide teaches you how to use the Open Source Policy Center's Tax Calculator. To follow along you will need the following: \n",
"This guide teaches you how to use Tax-Calculator. To follow along you will need the following: \n",
"\n",
"1. A copy of the taxcalc package installed on your local machine.\n",
"2. A copy of the puf.csv file output from the TaxData repository. "
Expand Down Expand Up @@ -55,9 +55,9 @@
"# The baseline includes AMT repeal. \n",
"p_xx = Policy()\n",
"reform_xx = {\n",
" 2016: {\n",
" '_AMT_trt1': [0.0],\n",
" '_AMT_trt2': [0.0]\n",
" 2017: {\n",
" '_AMT_rt1': [0.0],\n",
" '_AMT_rt2': [0.0]\n",
" }\n",
"}\n",
"p_xx.implement_reform(reform_xx)\n",
Expand All @@ -67,10 +67,10 @@
"\n",
"p_yy = Policy()\n",
"reform_yy = {\n",
" 2016: {\n",
" 2017: {\n",
" '_II_brk2': [[65005, 130010, 65005, 88180, 0, 0]],\n",
" '_AMT_trt1': [0.0],\n",
" '_AMT_trt2': [0.0]\n",
" '_AMT_rt1': [0.0],\n",
" '_AMT_rt2': [0.0]\n",
" }\n",
"}\n",
"p_yy.implement_reform(reform_yy)"
Expand All @@ -80,32 +80,60 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Create calculator objects with default tax data and advance the calculator to 2016"
"### Create calculator objects with default tax data\n",
"###### The data are automatically extrapolated to 2013 since that is the first tax year modeled by Tax-Calculator. "
]
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"../../taxcalc/behavior.py:190: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future\n",
" val = values[year]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"You loaded data for 2009.\n",
"Your data have been extrapolated to 2016.\n",
"Instantiation of the calculator automatically extrapolated your data to 2013.\n",
"You loaded data for 2009.\n",
"Your data have been extrapolated to 2013.\n"
"Instantiation of the calculator automatically extrapolated your data to 2013.\n"
]
}
],
"source": [
"c_xx = Calculator(policy=p_xx, records=Records(\"../../puf.csv\"))\n",
"c_xx.advance_to_year(2016)\n",
"c_yy = Calculator(policy=p_yy, records=Records(\"../../puf.csv\"))\n",
"c_yy.advance_to_year(2016)"
"c_yy = Calculator(policy=p_yy, records=Records(\"../../puf.csv\"))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Advance the calculator objects to 2017 for this analysis. "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"c_xx.advance_to_year(2017)\n",
"c_yy.advance_to_year(2017)\n",
"assert c_xx.current_year == 2017\n",
"assert c_yy.current_year == 2017\n"
]
},
{
Expand All @@ -117,7 +145,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {
"collapsed": false
},
Expand All @@ -138,22 +166,11 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"-101735788190.66336"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"((c_yy.records._combined - c_xx.records._combined)*c_xx.records.s006).sum()"
]
Expand Down Expand Up @@ -184,7 +201,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.11"
"version": "2.7.12"
}
},
"nbformat": 4,
Expand Down
3 changes: 2 additions & 1 deletion taxcalc/calculate.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ def __init__(self, policy=None, records=None, verbose=True,
self.growth.apply_change(self.records)
self.records.increment_year()
if verbose:
print('Your data have been extrapolated to ' +
print('Instantiation of the calculator automatically ' +
'extrapolated your data to ' +
str(self.records.current_year) + '.')
assert self.policy.current_year == self.records.current_year

Expand Down

0 comments on commit 226a53e

Please sign in to comment.