#!/usr/bin/env python # coding: utf-8 # In[1]: import paramtools class TaxParams(paramtools.Parameters): defaults = { "schema": { "labels": { "year": { "type": "int", "validators": {"range": {"min": 2013, "max": 2027}} }, "marital_status": { "type": "str", "validators": {"choice": {"choices": ["single", "joint"]}} }, } }, "standard_deduction": { "title": "Standard deduction amount", "description": "Amount filing unit can use as a standard deduction.", "type": "float", "value": [ {"year": 2017, "marital_status": "single", "value": 6350}, {"year": 2017, "marital_status": "joint", "value": 12700}, {"year": 2018, "marital_status": "single", "value": 12000}, {"year": 2018, "marital_status": "joint", "value": 24000}, {"year": 2026, "marital_status": "single", "value": 7685}, {"year": 2026, "marital_status": "joint", "value": 15369}], "validators": { "range": { "min": 0, "max": 9e+99 } } }, } label_to_extend = "year" array_first = True params = TaxParams() params.standard_deduction # In[2]: params.adjust( { "standard_deduction": [ {"year": 2017, "value": 10000}, {"year": 2020, "marital_status": "single", "value": 15000}, {"year": 2021, "marital_status": "joint", "value": 20000} ] } ) params.standard_deduction # In[ ]: