{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([[ 6350., 12700.],\n", " [ 6350., 12700.],\n", " [ 6350., 12700.],\n", " [ 6350., 12700.],\n", " [ 6350., 12700.],\n", " [12000., 24000.],\n", " [12000., 24000.],\n", " [12000., 24000.],\n", " [12000., 24000.],\n", " [12000., 24000.],\n", " [12000., 24000.],\n", " [12000., 24000.],\n", " [12000., 24000.],\n", " [ 7685., 15369.],\n", " [ 7685., 15369.]])" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import paramtools\n", "\n", "\n", "class TaxParams(paramtools.Parameters):\n", " defaults = {\n", " \"schema\": {\n", " \"labels\": {\n", " \"year\": {\n", " \"type\": \"int\",\n", " \"validators\": {\"range\": {\"min\": 2013, \"max\": 2027}}\n", " },\n", " \"marital_status\": {\n", " \"type\": \"str\",\n", " \"validators\": {\"choice\": {\"choices\": [\"single\", \"joint\"]}}\n", " },\n", " }\n", " },\n", " \"standard_deduction\": {\n", " \"title\": \"Standard deduction amount\",\n", " \"description\": \"Amount filing unit can use as a standard deduction.\",\n", " \"type\": \"float\",\n", " \"value\": [\n", " {\"year\": 2017, \"marital_status\": \"single\", \"value\": 6350},\n", " {\"year\": 2017, \"marital_status\": \"joint\", \"value\": 12700},\n", " {\"year\": 2018, \"marital_status\": \"single\", \"value\": 12000},\n", " {\"year\": 2018, \"marital_status\": \"joint\", \"value\": 24000},\n", " {\"year\": 2026, \"marital_status\": \"single\", \"value\": 7685},\n", " {\"year\": 2026, \"marital_status\": \"joint\", \"value\": 15369}],\n", " \"validators\": {\n", " \"range\": {\n", " \"min\": 0,\n", " \"max\": 9e+99\n", " }\n", " }\n", " },\n", " }\n", "\n", " label_to_extend = \"year\"\n", " array_first = True\n", "\n", "params = TaxParams()\n", "\n", "params.standard_deduction" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([[ 6350., 12700.],\n", " [ 6350., 12700.],\n", " [ 6350., 12700.],\n", " [ 6350., 12700.],\n", " [10000., 10000.],\n", " [10000., 10000.],\n", " [10000., 10000.],\n", " [15000., 10000.],\n", " [15000., 20000.],\n", " [15000., 20000.],\n", " [15000., 20000.],\n", " [15000., 20000.],\n", " [15000., 20000.],\n", " [15000., 20000.],\n", " [15000., 20000.]])" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "params.adjust(\n", " {\n", " \"standard_deduction\": [\n", " {\"year\": 2017, \"value\": 10000},\n", " {\"year\": 2020, \"marital_status\": \"single\", \"value\": 15000},\n", " {\"year\": 2021, \"marital_status\": \"joint\", \"value\": 20000}\n", " ]\n", " }\n", ")\n", "\n", "params.standard_deduction" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.3" } }, "nbformat": 4, "nbformat_minor": 2 }