-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8e3ae3d
commit 6f34a1e
Showing
2 changed files
with
137 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from tax_microdata_benchmarking.create_flat_file import taxcalc_extension | ||
from policyengine_us import Simulation | ||
import pandas as pd | ||
from pathlib import Path | ||
|
||
sim = Simulation(reform=taxcalc_extension, situation={"person_id": 1}) | ||
taxcalc_cps = pd.read_csv("cps.csv.gz") | ||
|
||
summary_file = """# PolicyEngine US Tax-Calculator flat file | ||
This file contains a summary of the Tax-Calculator microdata file. It is intended to be used as a reference for the Tax-Calculator microdata file. | ||
""" | ||
|
||
added_columns = [] | ||
|
||
variables = sim.tax_benefit_system.variables | ||
for variable in variables.values(): | ||
if variable.name.startswith("tc_"): | ||
added_columns.append(variable.name[3:]) | ||
|
||
# Add 'The flat file currently has X out of Y (Z%) columns in the Tax-Calculator CPS microdata file'. | ||
|
||
summary_file += f"\nThe flat file currently has {len(added_columns)} out of 68 ({len(added_columns) / len(taxcalc_cps.columns):.0%}) columns in the Tax-Calculator CPS microdata file.\n" | ||
|
||
for variable in variables.values(): | ||
if variable.name.startswith("tc_"): | ||
summary_file += f"\n## {variable.name[3:]}\n\n{variable.label}\n\n" | ||
|
||
FOLDER = Path(__file__).parent | ||
|
||
with open(FOLDER / "summary.md", "w") as file: | ||
file.write(summary_file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# PolicyEngine US Tax-Calculator flat file | ||
|
||
This file contains a summary of the Tax-Calculator microdata file. It is intended to be used as a reference for the Tax-Calculator microdata file. | ||
|
||
The flat file currently has 20 out of 68 (29%) columns in the Tax-Calculator CPS microdata file. | ||
|
||
## RECID | ||
|
||
record ID | ||
|
||
|
||
## MARS | ||
|
||
filing status | ||
|
||
|
||
## e00200p | ||
|
||
wages less pension contributions (filer) | ||
|
||
|
||
## e00200s | ||
|
||
wages less pension contributions (spouse) | ||
|
||
|
||
## e00200 | ||
|
||
TaxCalc Variable Alias | ||
|
||
|
||
## age_head | ||
|
||
age of head of tax unit | ||
|
||
|
||
## age_spouse | ||
|
||
age of spouse of head of tax unit | ||
|
||
|
||
## blind_head | ||
|
||
blindness of head of tax unit | ||
|
||
|
||
## blind_spouse | ||
|
||
blindness of spouse of head of tax unit | ||
|
||
|
||
## fips | ||
|
||
FIPS state code | ||
|
||
|
||
## s006 | ||
|
||
tax unit weight | ||
|
||
|
||
## FLPDYR | ||
|
||
tax year to calculate for | ||
|
||
|
||
## EIC | ||
|
||
EITC-qualifying children | ||
|
||
|
||
## nu18 | ||
|
||
number of people under 18 | ||
|
||
|
||
## n1820 | ||
|
||
number of people 18-20 | ||
|
||
|
||
## nu13 | ||
|
||
number of people under 13 | ||
|
||
|
||
## nu06 | ||
|
||
number of people under 6 | ||
|
||
|
||
## n24 | ||
|
||
number of people eligible for the CTC | ||
|
||
|
||
## elderly_dependents | ||
|
||
number of elderly dependents | ||
|
||
|
||
## f2441 | ||
|
||
CDCC-qualifying children | ||
|