Fix stat_dataframe function nested in create_distribution_table utility function #1834
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.
This pull request fixes a Tax-Calculator bug that was diagnosed by @hdoupe in PolicyBrain issue 794. His ingenious scripts determined that the bug was in Tax-Calculator (because the dictionary tbi results were different from the dataframe tbi results) and that those differences occurred only in distribution table results, not in difference table results or aggregate results. Thanks @hdoupe for the extremely helpful bug report!
Using Hank's script (that compares tbi distribution table results returned as a dataframe with tbi distribution table results returned as a dictionary), I used standard bisection methods to determine that there were no differences in release 0.13.2 and earlier and differences in the next release, which was numbered 0.14.0, and in subsequent releases. Then reviewing commits made during the few weeks between 0.13.2 (2017-11-17) and 0.14.0 (2017-12-11), revealed commit aef4b20 that introduced a nested function called
stat_dataframe
into thecreate_distribution_table
utility function. Given @hdoupe's diagnosis (the numbers in the dictionary were correct but they were not associated with the correct variable), the source of the bug was obvious once attention was focused on thestat_dataframe
function.The changes in this pull request leave all the unit and validation tests that were passing before this pull request still passing. There are no changes in tax calculating logic.
My guess is that this (now fixed) bug affected only TaxBrain, not other clients of Tax-Calculator.