From 0150ee1ba5424cf3d55c05a4c352ad01f0ee0fef Mon Sep 17 00:00:00 2001 From: jdebacker Date: Tue, 6 Feb 2024 21:24:49 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20=20@=2051b09?= =?UTF-8?q?412a719080c5b42cd64ee09401fc851004d=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _modules/taxcalc/taxcalcio.html | 43 +++++++++++++++++++++++++-------- api/taxcalcio.html | 9 ++++--- recipes/recipe00.html | 6 ++--- searchindex.js | 2 +- 4 files changed, 42 insertions(+), 18 deletions(-) diff --git a/_modules/taxcalc/taxcalcio.html b/_modules/taxcalc/taxcalcio.html index e1d497cfe..13f377763 100644 --- a/_modules/taxcalc/taxcalcio.html +++ b/_modules/taxcalc/taxcalcio.html @@ -822,8 +822,9 @@

Source code for taxcalc.taxcalcio

            calculated variables using their Tax-Calculator names
 
         output_sqldb: boolean
-           whether or not to write SQLite3 database with dump table
-           containing same output as written by output_dump to a csv file
+           whether or not to write SQLite3 database with two tables
+           (baseline and reform) each containing same output as written
+           by output_dump to a csv file
 
         Returns
         -------
@@ -844,10 +845,17 @@ 

Source code for taxcalc.taxcalcio

             (mtr_paytax, mtr_inctax,
              _) = self.calc.mtr(wrt_full_compensation=False,
                                 calc_all_already_called=True)
+            self.calc_base.calc_all()
+            calc_base_calculated = True
+            (mtr_paytax_base, mtr_inctax_base,
+             _) = self.calc_base.mtr(wrt_full_compensation=False,
+                                     calc_all_already_called=True)
         else:
             # definitely do not need marginal tax rates
             mtr_paytax = None
             mtr_inctax = None
+            mtr_paytax_base = None
+            mtr_inctax_base = None
         # extract output if writing_output_file
         if writing_output_file:
             self.write_output_file(output_dump, dump_varset,
@@ -855,7 +863,10 @@ 

Source code for taxcalc.taxcalcio

             self.write_doc_file()
         # optionally write --sqldb output to SQLite3 database
         if output_sqldb:
-            self.write_sqldb_file(dump_varset, mtr_paytax, mtr_inctax)
+            self.write_sqldb_file(
+                dump_varset, mtr_paytax, mtr_inctax,
+                mtr_paytax_base, mtr_inctax_base
+            )
         # optionally write --tables output to text file
         if output_tables:
             if not calc_base_calculated:
@@ -875,7 +886,9 @@ 

Source code for taxcalc.taxcalcio

         Write output to CSV-formatted file.
         """
         if output_dump:
-            outdf = self.dump_output(dump_varset, mtr_inctax, mtr_paytax)
+            outdf = self.dump_output(
+                self.calc, dump_varset, mtr_inctax, mtr_paytax
+            )
             column_order = sorted(outdf.columns)
         else:
             outdf = self.minimal_output()
@@ -899,15 +912,25 @@ 

Source code for taxcalc.taxcalcio

         with open(doc_fname, 'w') as dfile:
             dfile.write(doc)
-
[docs] def write_sqldb_file(self, dump_varset, mtr_paytax, mtr_inctax): +
[docs] def write_sqldb_file(self, dump_varset, mtr_paytax, mtr_inctax, + mtr_paytax_base, mtr_inctax_base): """ Write dump output to SQLite3 database table dump. """ - outdf = self.dump_output(dump_varset, mtr_inctax, mtr_paytax) - assert len(outdf.index) == self.calc.array_len db_fname = self._output_filename.replace('.csv', '.db') dbcon = sqlite3.connect(db_fname) - outdf.to_sql('dump', dbcon, if_exists='replace', index=False) + # write baseline table + outdf = self.dump_output( + self.calc_base, dump_varset, mtr_inctax_base, mtr_paytax_base + ) + assert len(outdf.index) == self.calc.array_len + outdf.to_sql('baseline', dbcon, if_exists='replace', index=False) + # write reform table + outdf = self.dump_output( + self.calc, dump_varset, mtr_inctax, mtr_paytax + ) + assert len(outdf.index) == self.calc.array_len + outdf.to_sql('reform', dbcon, if_exists='replace', index=False) dbcon.close() del outdf gc.collect()
@@ -1082,7 +1105,7 @@

Source code for taxcalc.taxcalcio

         odf = pd.DataFrame(data=odict, columns=varlist)
         return odf
-
[docs] def dump_output(self, dump_varset, mtr_inctax, mtr_paytax): +
[docs] def dump_output(self, calcx, dump_varset, mtr_inctax, mtr_paytax): """ Extract dump output and return it as Pandas DataFrame. """ @@ -1094,7 +1117,7 @@

Source code for taxcalc.taxcalcio

         # create and return dump output DataFrame
         odf = pd.DataFrame()
         for varname in varset:
-            vardata = self.calc.array(varname)
+            vardata = calcx.array(varname)
             if varname in recs_vinfo.INTEGER_VARS:
                 odf[varname] = vardata
             else:
diff --git a/api/taxcalcio.html b/api/taxcalcio.html
index f33d120ae..e66a1b458 100644
--- a/api/taxcalcio.html
+++ b/api/taxcalcio.html
@@ -523,8 +523,9 @@ 

taxcalc.taxcalcioReturn type: @@ -543,7 +544,7 @@

taxcalc.taxcalcio
-dump_output(dump_varset, mtr_inctax, mtr_paytax)[source]#
+dump_output(calcx, dump_varset, mtr_inctax, mtr_paytax)[source]#

Extract dump output and return it as Pandas DataFrame.

@@ -598,7 +599,7 @@

taxcalc.taxcalcio
-write_sqldb_file(dump_varset, mtr_paytax, mtr_inctax)[source]#
+write_sqldb_file(dump_varset, mtr_paytax, mtr_inctax, mtr_paytax_base, mtr_inctax_base)[source]#

Write dump output to SQLite3 database table dump.

diff --git a/recipes/recipe00.html b/recipes/recipe00.html index 50d2f03c1..db28c2629 100644 --- a/recipes/recipe00.html +++ b/recipes/recipe00.html @@ -959,11 +959,11 @@

Plotting -
+