From d8b7e5ededda6068804082ea157e19283c60e7f3 Mon Sep 17 00:00:00 2001 From: jdebacker Date: Tue, 1 Mar 2022 21:50:08 -0500 Subject: [PATCH 1/2] updat expected puf files --- taxcalc/tests/puf_var_wght_means_by_year.csv | 10 ++--- taxcalc/tests/pufcsv_agg_expect.csv | 40 ++++++++++---------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/taxcalc/tests/puf_var_wght_means_by_year.csv b/taxcalc/tests/puf_var_wght_means_by_year.csv index 52f96f647..6842aaced 100644 --- a/taxcalc/tests/puf_var_wght_means_by_year.csv +++ b/taxcalc/tests/puf_var_wght_means_by_year.csv @@ -1,10 +1,10 @@ ,description,2013,2014,2015,2016,2017,2018,2019,2020,2021,2022,2023,2024,2025,2026,2027,2028,2029,2030,2031 -c00100,Federal AGI, 50840, 54457, 54942, 55071, 58036, 60303, 62172, 61116, 65224, 65988, 67385, 69234, 71264, 73212, 75046, 76999, 78977, 81033, 83346 +c00100,Federal AGI, 50840, 54457, 54942, 55071, 58036, 60303, 62172, 61116, 65223, 65987, 67384, 69233, 71263, 73211, 75045, 76998, 78975, 81032, 83345 c02500,OASDI benefits in AGI, 1295, 1394, 1416, 1479, 1503, 1593, 1695, 1799, 1927, 2013, 2143, 2288, 2444, 2613, 2788, 2984, 3188, 3406, 3649 c04470,Post-phase-out itemized deduction, 5907, 6036, 6149, 6381, 6590, 6848, 7032, 7444, 7484, 7399, 7607, 7850, 8118, 8411, 8698, 9012, 9324, 9651, 10025 c04600,Post-phase-out personal exemption, 7105, 7131, 7163, 7217, 7149, 7262, 7408, 7528, 7582, 7706, 7843, 7994, 8154, 8320, 8497, 8681, 8874, 9072, 9271 -c04800,Federal regular taxable income, 35754, 39298, 39664, 39592, 42556, 44439, 45949, 44282, 48197, 49000, 50012, 51438, 53007, 54454, 55773, 57172, 58577, 60037, 61691 -c05200,Regular tax on taxable income, 7672, 8732, 8725, 8585, 9495, 9967, 10327, 9767, 10808, 11035, 11209, 11509, 11853, 12158, 12427, 12713, 12995, 13286, 13612 +c04800,Federal regular taxable income, 35754, 39298, 39664, 39592, 42556, 44439, 45949, 44282, 48196, 48999, 50011, 51437, 53006, 54453, 55772, 57171, 58576, 60036, 61690 +c05200,Regular tax on taxable income, 7672, 8732, 8725, 8585, 9495, 9967, 10327, 9767, 10808, 11035, 11209, 11509, 11853, 12158, 12427, 12712, 12995, 13286, 13611 c07180,Child care credit, 17, 17, 17, 17, 17, 17, 17, 17, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 c07220,Child tax credit (adjusted), 158, 155, 147, 143, 139, 133, 129, 124, 303, 119, 115, 111, 108, 104, 100, 97, 94, 91, 88 c09600,Federal AMT liability, 212, 227, 240, 251, 271, 284, 292, 312, 313, 311, 317, 326, 338, 351, 362, 376, 391, 405, 420 @@ -67,7 +67,7 @@ e87530,Adjusted qualified lifetime learning expenses for all students, 93, eitc,Federal EITC, 376, 369, 364, 352, 342, 341, 344, 353, 341, 347, 348, 350, 352, 356, 361, 366, 372, 379, 385 elderly_dependents,number of dependents age 65+ in filing unit excluding taxpayer and spouse, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 g20500,Itemizable gross (before 10% AGI disregard) casualty or theft loss, 29, 30, 31, 32, 34, 35, 36, 38, 38, 38, 39, 41, 42, 43, 45, 47, 50, 52, 55 -iitax,Federal income tax liability, 6550, 7474, 7521, 7477, 8279, 8719, 9042, 5959, 7170, 9701, 9946, 10290, 10664, 10992, 11274, 11567, 11852, 12141, 12463 +iitax,Federal income tax liability, 6550, 7474, 7521, 7477, 8279, 8719, 9042, 5959, 7169, 9700, 9945, 10290, 10664, 10991, 11274, 11566, 11852, 12140, 12462 k1bx14p,Partner self-employment earnings/loss for taxpayer (included in e26270 total), -213, -239, -187, -162, -144, -136, -127, -116, -129, -133, -142, -148, -152, -151, -146, -136, -121, -102, -86 k1bx14s,Partner self-employment earnings/loss for spouse (included in e26270 total), -7, -9, 0, 2, 8, 10, 11, 9, 11, 11, 11, 12, 13, 15, 17, 19, 21, 25, 26 nu06,Number of dependents under 6 years old, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 @@ -75,6 +75,6 @@ nu13,Number of dependents under 13 years old, 0, 0, 0, 0 p08000,Other tax credits (but not including Sch R credit), 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 p22250,Sch D: Net short-term capital gains/losses, -120, -173, -172, -151, -195, -211, -238, -224, -277, -283, -263, -247, -243, -241, -241, -240, -244, -243, -238 p23250,Sch D: Net long-term capital gains/losses, 2284, 3191, 3138, 2776, 3680, 3911, 4262, 3868, 4720, 4718, 4301, 4064, 3945, 3882, 3863, 3885, 3934, 3995, 4082 -payrolltax,Payroll taxes (ee+er) for OASDI+HI, 5193, 5382, 5440, 5515, 5676, 5833, 6012, 5989, 6165, 6352, 6536, 6737, 6945, 7146, 7327, 7508, 7690, 7876, 8082 +payrolltax,Payroll taxes (ee+er) for OASDI+HI, 5193, 5382, 5440, 5515, 5676, 5833, 6012, 5987, 6205, 6393, 6579, 6781, 6991, 7192, 7374, 7557, 7739, 7926, 8133 pencon_p,Contributions to defined-contribution pension plans for taxpayer, 857, 899, 918, 942, 965, 997, 1029, 1019, 1055, 1089, 1122, 1158, 1195, 1229, 1259, 1292, 1324, 1355, 1389 pencon_s,Contributions to defined-contribution pension plans for spouse, 392, 409, 420, 423, 439, 452, 465, 460, 476, 491, 505, 520, 535, 550, 562, 575, 586, 598, 612 diff --git a/taxcalc/tests/pufcsv_agg_expect.csv b/taxcalc/tests/pufcsv_agg_expect.csv index 79a835834..0e9b094d2 100644 --- a/taxcalc/tests/pufcsv_agg_expect.csv +++ b/taxcalc/tests/pufcsv_agg_expect.csv @@ -1,26 +1,26 @@ ,2017,2018,2019,2020,2021,2022,2023,2024,2025,2026 Returns (#m),190.9,194.3,197.3,200.1,202.9,205.6,208.4,211.2,214.0,216.7 -AGI ($b),11080.9,11811.6,12357.5,12310.1,13328.2,13665.6,14146.7,14731.8,15367.9,15985.9 -Itemizers (#m),45.7,19.6,20.3,21.0,21.8,21.0,21.5,22.0,22.5,52.1 -Itemized Deduction ($b),1279.5,608.8,639.3,688.6,711.7,692.9,722.7,756.2,793.5,1854.6 -Standard Deduction Filers (#m),145.2,174.6,177.0,179.0,181.0,184.6,186.9,189.1,191.4,164.6 -Standard Deduction ($b),1238.9,2860.2,2949.2,3034.3,3093.6,3212.8,3313.6,3422.1,3536.5,1642.5 -Personal Exemption ($b),1364.9,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1734.7 -Taxable Income ($b),8109.9,9171.4,9634.0,9476.9,10409.7,10714.5,11094.2,11569.4,12090.0,11917.4 -Regular Tax ($b),1655.9,1707.9,1794.9,1742.1,1930.1,1997.7,2077.3,2176.5,2283.8,2495.5 -AMT Income ($b),10514.1,11420.4,11944.1,11859.8,12863.0,13213.5,13671.1,14230.8,14838.9,15154.4 -AMT Liability ($b),51.8,23.4,24.5,25.9,26.8,27.0,27.6,28.7,30.1,80.3 -AMT Filers (#m),5.7,0.6,1.0,1.0,1.0,1.0,1.0,1.1,1.1,7.9 -Tax before Credits ($b),1707.8,1731.3,1819.3,1768.0,1956.9,2024.7,2104.9,2205.3,2314.0,2575.8 -Refundable Credits ($b),103.0,117.6,118.9,645.2,760.6,122.1,123.1,124.2,126.4,111.7 -Nonrefundable Credits ($b),66.9,126.9,128.3,126.0,51.2,132.1,134.9,137.8,140.4,75.4 +AGI ($b),11080.9,11811.6,12357.5,12310.1,13328.0,13665.4,14146.5,14731.6,15367.7,15868.1 +Itemizers (#m),45.7,19.6,20.2,20.8,21.6,20.3,20.7,21.2,21.7,51.9 +Itemized Deduction ($b),1279.5,608.8,639.1,686.2,708.8,677.7,706.7,739.0,776.5,1853.7 +Standard Deduction Filers (#m),145.2,174.6,177.0,179.2,181.2,185.3,187.6,190.0,192.2,164.8 +Standard Deduction ($b),1238.9,2860.2,2949.9,3039.5,3105.1,3284.1,3387.4,3498.8,3615.4,1669.3 +Personal Exemption ($b),1364.9,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1762.0 +Taxable Income ($b),8109.9,9171.4,9634.0,9474.9,10404.7,10680.3,11058.9,11532.9,12052.2,11829.4 +Regular Tax ($b),1655.9,1707.9,1794.9,1763.1,1927.6,1985.0,2064.0,2162.6,2269.2,2465.2 +AMT Income ($b),10514.1,11420.4,11944.2,11861.0,12864.7,13222.7,13680.9,14241.5,14849.4,15038.0 +AMT Liability ($b),51.8,23.4,24.4,24.8,26.6,26.7,27.4,28.5,29.9,76.7 +AMT Filers (#m),5.7,0.6,0.6,0.3,0.6,0.6,0.6,0.6,0.6,7.3 +Tax before Credits ($b),1707.8,1731.3,1819.2,1787.9,1954.3,2011.8,2091.4,2191.1,2299.2,2542.0 +Refundable Credits ($b),103.0,117.6,118.9,644.8,760.2,124.8,125.9,127.0,129.4,114.7 +Nonrefundable Credits ($b),66.9,126.9,128.3,126.1,51.5,131.9,134.7,137.6,140.3,75.5 Reform Surtaxes ($b),0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0 -Other Taxes ($b),40.0,45.0,48.3,45.5,53.5,54.5,52.6,52.2,52.8,53.7 -Ind Income Tax ($b),1577.9,1531.8,1620.4,1042.3,1198.6,1825.0,1899.5,1995.4,2099.9,2442.4 -Payroll Taxes ($b),1083.8,1133.1,1186.2,1198.2,1250.8,1306.3,1362.3,1422.8,1486.2,1548.8 -Combined Liability ($b),2661.7,2664.9,2806.6,2240.5,2449.5,3131.3,3261.8,3418.2,3586.1,3991.2 -With Income Tax <= 0 (#m),92.8,98.5,99.2,132.6,126.2,102.3,103.3,104.1,105.1,101.1 -With Combined Tax <= 0 (#m),63.3,65.5,66.6,102.7,95.5,69.9,71.0,72.0,73.0,72.6 +Other Taxes ($b),40.0,45.0,48.3,45.5,53.5,54.5,52.6,52.2,52.8,52.0 +Ind Income Tax ($b),1577.9,1531.8,1620.3,1062.5,1196.1,1809.6,1883.4,1978.6,2082.3,2403.8 +Payroll Taxes ($b),1083.8,1133.1,1186.2,1197.8,1259.0,1314.8,1371.2,1432.1,1495.9,1558.9 +Combined Liability ($b),2661.7,2664.9,2806.5,2260.3,2455.1,3124.4,3254.6,3410.7,3578.2,3962.7 +With Income Tax <= 0 (#m),92.8,98.5,99.6,132.4,126.6,103.2,104.2,105.0,106.0,101.9 +With Combined Tax <= 0 (#m),63.3,65.5,66.7,102.7,95.5,70.3,71.4,72.4,73.4,72.9 UBI Benefits ($b),0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0 "Total Benefits, Consumption Value ($b)",1052.3,1104.9,1174.1,1244.8,1494.0,1406.5,1489.3,1579.4,1672.9,1772.0 Total Benefits Cost ($b),1052.3,1104.9,1174.1,1244.8,1494.0,1406.5,1489.3,1579.4,1672.9,1772.0 From e5271102ec88744b1d1c1f3063cd97448f43bc6a Mon Sep 17 00:00:00 2001 From: jdebacker Date: Wed, 2 Mar 2022 13:34:34 -0500 Subject: [PATCH 2/2] fix div by zero error --- taxcalc/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/taxcalc/utils.py b/taxcalc/utils.py index e99855572..8f45c2e82 100644 --- a/taxcalc/utils.py +++ b/taxcalc/utils.py @@ -584,7 +584,7 @@ def count_gt_zero(dframe, col_name, tolerance=0.001): out=np.zeros_like(diff_table['tot_change'].values), where=total_change > 0) quotient = np.divide( - diff_table['atinc2'].values, diff_table['atinc1'], + diff_table['atinc2'].values, diff_table['atinc1'].values, out=np.zeros_like(diff_table['atinc2'].values), where=diff_table['atinc1'] != 0) diff_table['pc_aftertaxinc'] = np.where(