Skip to content

Commit

Permalink
Merge pull request #1277 from MattHJensen/fix-notebooks
Browse files Browse the repository at this point in the history
fix notebooks
  • Loading branch information
MattHJensen authored Apr 10, 2017
2 parents 2b037ca + 602002c commit e381c9d
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 54 deletions.
39 changes: 21 additions & 18 deletions docs/notebooks/10_Minutes_to_Tax-Calculator.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 3,
"metadata": {
"collapsed": false
},
Expand All @@ -46,7 +46,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 4,
"metadata": {
"collapsed": false
},
Expand All @@ -68,7 +68,7 @@
"p_yy = Policy()\n",
"reform_yy = {\n",
" 2017: {\n",
" '_II_brk2': [[65005, 130010, 65005, 88180, 0, 0]],\n",
" '_II_brk2': [[65005, 130010, 65005, 88180, 0]],\n",
" '_AMT_rt1': [0.0],\n",
" '_AMT_rt2': [0.0]\n",
" }\n",
Expand All @@ -86,27 +86,19 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 5,
"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",
"Instantiation of the calculator automatically extrapolated your data to 2013.\n",
"Tax-Calculator startup automatically extrapolated your data to 2013.\n",
"You loaded data for 2009.\n",
"Instantiation of the calculator automatically extrapolated your data to 2013.\n"
"Tax-Calculator startup automatically extrapolated your data to 2013.\n"
]
}
],
Expand All @@ -124,7 +116,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {
"collapsed": false
},
Expand All @@ -145,7 +137,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {
"collapsed": false
},
Expand All @@ -166,11 +158,22 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"-102894721202.03145"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"((c_yy.records._combined - c_xx.records._combined)*c_xx.records.s006).sum()"
]
Expand Down
73 changes: 37 additions & 36 deletions docs/notebooks/Behavioral_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 5,
"metadata": {
"collapsed": false
},
Expand All @@ -32,7 +32,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 6,
"metadata": {
"collapsed": false
},
Expand All @@ -42,17 +42,9 @@
"output_type": "stream",
"text": [
"You loaded data for 2009.\n",
"Your data have been extrapolated to 2013.\n",
"Tax-Calculator startup automatically extrapolated your data to 2013.\n",
"You loaded data for 2009.\n",
"Your data have been extrapolated to 2013.\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/psteinberg/anaconda/envs/webapp/lib/python2.7/site-packages/pandas/io/parsers.py:1170: DtypeWarning: Columns (204,205) have mixed types. Specify dtype option on import or set low_memory=False.\n",
" data = self._reader.read(nrows)\n"
"Tax-Calculator startup automatically extrapolated your data to 2013.\n"
]
}
],
Expand All @@ -79,7 +71,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 7,
"metadata": {
"collapsed": false
},
Expand Down Expand Up @@ -111,24 +103,24 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# Call the behavioral effects calculator and create new Plan Y Calculator obects. \n",
"behavior_y.update_behavior({2013: {'_BE_inc': [0.15], '_BE_sub': [0.4]}})\n",
"calcY_behavior1 = behavior(calcX, calcY)\n",
"behavior_y.update_behavior({2013: {'_BE_inc': [0.15], '_BE_sub': [0.5]}})\n",
"calcY_behavior2 = behavior(calcX, calcY)\n",
"behavior_y.update_behavior({2013: {'_BE_inc': [-0.15], '_BE_sub': [0.4]}})\n",
"calcY_behavior1 = Behavior.response(calcX, calcY)\n",
"behavior_y.update_behavior({2013: {'_BE_inc': [-0.15], '_BE_sub': [0.5]}})\n",
"calcY_behavior2 = Behavior.response(calcX, calcY)\n",
"behavior_y.update_behavior({2013: {'_BE_inc': [0.0], '_BE_sub': [0.4]}})\n",
"calcY_behavior3 = behavior(calcX, calcY) "
"calcY_behavior3 = Behavior.response(calcX, calcY) "
]
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 9,
"metadata": {
"collapsed": false
},
Expand All @@ -137,10 +129,10 @@
"name": "stdout",
"output_type": "stream",
"text": [
"32329002724\n",
"31047019924.0\n",
"30671634834.6\n",
"30827462366.3\n"
"35080581541.0\n",
"33582115995.2\n",
"33154108432.3\n",
"33368551289.3\n"
]
}
],
Expand All @@ -154,7 +146,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 12,
"metadata": {
"collapsed": false
},
Expand All @@ -163,22 +155,31 @@
"name": "stdout",
"output_type": "stream",
"text": [
"31480202328.8\n",
"36096622590.6\n",
"33957881240.1\n",
"33349777977.8\n",
"33609522097.7\n"
"34683545802.6\n",
"36879912372.0\n",
"35007096647.0\n",
"34516208441.9\n",
"34824908321.9\n"
]
}
],
"source": [
"# Demonstrate that total tax was affected by the behavioral effects. \n",
"print(calcX.records._ospctax.sum())\n",
"print(calcY.records._ospctax.sum())\n",
"print(calcY_behavior1.records._ospctax.sum())\n",
"print(calcY_behavior2.records._ospctax.sum())\n",
"print(calcY_behavior3.records._ospctax.sum())"
"print(calcX.records._combined.sum())\n",
"print(calcY.records._combined.sum())\n",
"print(calcY_behavior1.records._combined.sum())\n",
"print(calcY_behavior2.records._combined.sum())\n",
"print(calcY_behavior3.records._combined.sum())"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -197,7 +198,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.10"
"version": "2.7.12"
}
},
"nbformat": 4,
Expand Down

0 comments on commit e381c9d

Please sign in to comment.