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

Rename and reorder difference table columns #1584

Merged
merged 5 commits into from
Oct 17, 2017
Merged

Rename and reorder difference table columns #1584

merged 5 commits into from
Oct 17, 2017

Conversation

martinholmer
Copy link
Collaborator

@martinholmer martinholmer commented Oct 10, 2017

This pull request tries to make difference table columns more consistently named and in a more sensible column order. These changes were made after dealing with the questions of a TaxBrain user in issue #1581.

@codecov-io
Copy link

codecov-io commented Oct 10, 2017

Codecov Report

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

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #1584   +/-   ##
======================================
  Coverage     100%    100%           
======================================
  Files          37      37           
  Lines        2738    2739    +1     
======================================
+ Hits         2738    2739    +1
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 30c4567...d0a4f67. Read the comment docs.

@martinholmer
Copy link
Collaborator Author

Analyzing the EITC reform in the BrownKhanna.json file on the master branch, the create_difference_table(..., groupby='weighted_deciles', income_measure='expanded_income', tax_to_diff='combined')` returns a Pandas DataFrame that looks like this:

        tax_cut  tax_inc       count     mean       tot_change perc_inc perc_cut share_of_change perc_aftertax
0     2,207,709        0  16,762,370     -122   -2,037,617,844    0.00%   13.17%           1.49%        -2.80%
1     7,077,443        0  16,763,990   -1,004  -16,838,665,691    0.00%   42.22%          12.34%       -10.28%
2     7,774,019        0  16,762,079   -1,530  -25,647,234,620    0.00%   46.38%          18.80%        -9.23%
3    10,497,689        0  16,763,669   -1,878  -31,475,230,797    0.00%   62.62%          23.07%        -8.18%
4    11,947,402        0  16,763,005   -1,590  -26,651,830,336    0.00%   71.27%          19.53%        -5.28%
5     6,779,702        0  16,763,313   -1,177  -19,728,537,903    0.00%   40.44%          14.46%        -3.00%
6     4,411,075        0  16,763,828     -733  -12,281,009,658    0.00%   26.31%           9.00%        -1.48%
7     1,287,857        0  16,762,557     -106   -1,778,933,626    0.00%    7.68%           1.30%        -0.17%
8            46        0  16,763,592       -0          -11,423    0.00%    0.00%           0.00%        -0.00%
9             0        0  16,763,403        0                0    0.00%    0.00%          -0.00%         0.00%
sums 51,982,943        0 167,631,805      n/a -136,439,071,897      n/a      n/a         100.00%           n/a

The same utility function call on this development branch returns a Pandas DataFrame that looks like this:

           count    tax_cut perc_cut  tax_inc perc_inc     mean       tot_change share_of_change perc_aftertax
0     16,762,370  2,207,709   13.17%        0    0.00%     -122   -2,037,617,844           1.49%        -2.80%
1     16,763,990  7,077,443   42.22%        0    0.00%   -1,004  -16,838,665,691          12.34%       -10.28%
2     16,762,079  7,774,019   46.38%        0    0.00%   -1,530  -25,647,234,620          18.80%        -9.23%
3     16,763,669 10,497,689   62.62%        0    0.00%   -1,878  -31,475,230,797          23.07%        -8.18%
4     16,763,005 11,947,402   71.27%        0    0.00%   -1,590  -26,651,830,336          19.53%        -5.28%
5     16,763,313  6,779,702   40.44%        0    0.00%   -1,177  -19,728,537,903          14.46%        -3.00%
6     16,763,828  4,411,075   26.31%        0    0.00%     -733  -12,281,009,658           9.00%        -1.48%
7     16,762,557  1,287,857    7.68%        0    0.00%     -106   -1,778,933,626           1.30%        -0.17%
8     16,763,592         46    0.00%        0    0.00%       -0          -11,423           0.00%        -0.00%
9     16,763,403          0    0.00%        0    0.00%        0                0          -0.00%         0.00%
sums 167,631,805 51,982,943      n/a        0      n/a      n/a -136,439,071,897         100.00%           n/a

@MattHJensen
Copy link
Contributor

This ordering is much better. Thanks @martinholmer.

@martinholmer martinholmer merged commit c835045 into PSLmodels:master Oct 17, 2017
@martinholmer martinholmer deleted the fix-diff-table-labels branch October 17, 2017 17:49
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