Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix stat_dataframe function nested in create_distribution_table utility function #1834

Merged
merged 2 commits into from
Jan 18, 2018
Merged

Fix stat_dataframe function nested in create_distribution_table utility function #1834

merged 2 commits into from
Jan 18, 2018

Conversation

martinholmer
Copy link
Collaborator

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 the create_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 the stat_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.

@codecov-io
Copy link

codecov-io commented Jan 17, 2018

Codecov Report

Merging #1834 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #1834   +/-   ##
======================================
  Coverage     100%    100%           
======================================
  Files          37      37           
  Lines        3098    3100    +2     
======================================
+ Hits         3098    3100    +2
Impacted Files Coverage Δ
taxcalc/utils.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 24b9d7d...36c1537. Read the comment docs.

@hdoupe
Copy link
Collaborator

hdoupe commented Jan 18, 2018

@martinholmer This looks good to me. Thanks for quickly isolating and fixing this bug. When will Tax-Calculator 0.15.0 be released?

PolicyBrain will require a few other updates to catch up with Tax-Calculator 0.15.0. It will probably be a day or two before we can do a PolicyBrain release with the update.

@martinholmer martinholmer merged commit e694593 into PSLmodels:master Jan 18, 2018
@martinholmer
Copy link
Collaborator Author

martinholmer commented Jan 18, 2018

@hdoupe asked in pull request #1834:

When will Tax-Calculator 0.15.0 be released?

PolicyBrain will require a few other updates to catch up with Tax-Calculator 0.15.0. It will probably be a day or two before we can do a PolicyBrain release with the update.

Today. Even though @andersonfrailey is making excellent progress on pull request #1719, I think its better to get 0.15.0 out now so that TaxBrain can use it asap. And then in a few more days, we'll merge #1719 and release 0.15.1 that contains that enhancement.

@hdoupe
Copy link
Collaborator

hdoupe commented Jan 18, 2018

Great, thanks @martinholmer

@martinholmer martinholmer deleted the fix-stat_dataframe branch January 27, 2018 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants