Merged
Conversation
- TaxCalculator tmd_constructor() now uses 'growfactors' instead of 'gfactors' - Reference TMD files for weights and growfactors
Changes for PUF and CPS files + deprecations
Member
|
@mitch-martin-ds thanks for your work on this PR. Tests are passing locally for me, so I'm going to merge this branch and resolve the GH Actions failures in another PR. |
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The latest version of Tax-Brain (
2.7.2at time of writing) is not compatible with Tax-Calculator4.5.0usage of TMD microdata. Recent releases of Tax-Calculator changed the tmd_constructor() parameters to intake grow-factors from using the keywordgfactorstogrowfactors. Because Tax-Brain is still using the old keyword-arguments, attempting to use TMD data via Tax-Brain will fail.Additionally, Tax-Brain does not set up use of the TMD weights file as described in the Tax-Calculator documentation.
This change set is an attempt at fixing the issue by modifying Tax-Brain's TMD usage setup to be compatible with the Tax-Calculator API, as well as to utilize the TMD weights file.
Reproducing the error
Using the Static Reform example from the Tax-Brain documentation site, we can validate running against CPS and demonstrate the error by running againsst TMD.
This was tested using Python 3.11.
python taxbrain_cps_vs_tmd.py Running taxbrain using CPS microdata Calculator reform data 2029 c07100 taxbc standard refund expanded_income ... combined benefit_cost_total c04600 payrolltax c04470 0 0.0 0.000000 12200.0 0.0 54791.148242 ... 0.000000 54791.148242 0.0 0.000000 0.000000 1 0.0 2936.056677 24400.0 0.0 55992.476179 ... 10720.064423 1224.604684 0.0 7784.007746 0.000000 2 0.0 0.000000 15500.0 0.0 42324.108411 ... 0.000000 42324.108411 0.0 0.000000 0.000000 3 0.0 561.226937 24400.0 0.0 33803.476252 ... 5337.506016 0.000000 0.0 0.000000 0.000000 4 0.0 4788.896912 24400.0 0.0 84905.807941 ... 13059.494001 0.000000 0.0 8270.597089 0.000000 ... ... ... ... ... ... ... ... ... ... ... ... 280000 0.0 12512.745301 13850.0 0.0 106525.089101 ... 12512.745301 35126.042188 0.0 0.000000 0.000000 280001 0.0 0.000000 13850.0 0.0 9572.452552 ... 0.000000 9518.211327 0.0 0.000000 0.000000 280002 0.0 2940.056393 24400.0 0.0 68097.558356 ... 10915.998577 11975.783988 0.0 7975.942184 0.000000 280003 0.0 5421.512480 0.0 0.0 60151.355731 ... 13967.215596 0.000000 0.0 8545.703116 12410.265629 280004 0.0 10231.690121 0.0 0.0 86851.994670 ... 22575.562496 0.000000 0.0 12343.872375 15347.376113 [280005 rows x 23 columns] Calculator reform data 2020 c07100 taxbc standard refund expanded_income ... combined benefit_cost_total c04600 payrolltax c04470 0 0.0 0.000000 7089.151966 1800.000000 56413.317272 ... -1800.000000 56413.317272 0.0 0.000000 0.000000 1 0.0 2773.060784 24800.000000 3600.000000 56383.858389 ... 7006.738284 1266.513105 0.0 7833.677500 0.000000 2 0.0 0.000000 15505.686144 1800.000000 43759.010206 ... -1800.000000 43759.010206 0.0 0.000000 0.000000 3 0.0 521.574282 25400.000000 3600.000000 34346.157259 ... 1774.531745 0.000000 0.0 0.000000 0.000000 4 0.0 4890.883725 24800.000000 3600.000000 87090.608958 ... 9614.255494 0.000000 0.0 8323.371769 0.000000 ... ... ... ... ... ... ... ... ... ... ... ... 280000 0.0 13561.078566 14050.000000 808.618508 112575.547265 ... 12752.460058 36324.435322 0.0 0.000000 0.000000 280001 0.0 0.000000 14050.000000 1800.000000 9560.351453 ... -1800.000000 9506.689578 0.0 0.000000 0.000000 280002 0.0 4103.062202 25400.000000 3600.000000 68735.642083 ... 8529.898873 12255.813745 0.0 8026.836671 0.000000 280003 0.0 5232.509033 0.000000 1800.000000 60534.768027 ... 12032.742281 0.000000 0.0 8600.233248 13314.155799 280004 0.0 10030.717758 0.000000 1490.257088 87406.177557 ... 20963.099295 0.000000 0.0 12422.638625 16464.322982 [280005 rows x 23 columns] ----- Running taxbrain using TMD microdata Traceback (most recent call last): File "/home/ec2-user/taxbrain-test/taxbrain_cps_vs_tmd.py", line 16, in <module> tb.run() File "/home/ec2-user/.local/lib/python3.11/site-packages/taxbrain/taxbrain.py", line 168, in run base_calc, reform_calc = self._make_calculators() ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ec2-user/.local/lib/python3.11/site-packages/taxbrain/taxbrain.py", line 692, in _make_calculators records = tc.Records.tmd_constructor( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: Records.tmd_constructor() got an unexpected keyword argument 'gfactors'Commits