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 zero weights issue #387

Merged
merged 5 commits into from
Jun 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ puf-files: data/cps-matched-puf.csv \

data/cps-matched-puf.csv: taxdata/puf/finalprep.py \
taxdata/puf/impute_itmexp.py \
taxdata/puf/impute_pencon.py
taxdata/puf/impute_pencon.py\
createpuf.py
python createpuf.py
# Above recipe also makes data/puf.csv

Expand Down
332 changes: 0 additions & 332 deletions Manifest.toml

This file was deleted.

4 changes: 0 additions & 4 deletions Project.toml

This file was deleted.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ To run the scripts that produce `puf.csv` and `cps.csv.gz`, activate the

`Julia` must also be installed to solve for the PUF and CPS weights. You
can download `Julia` from their [website](https://julialang.org/downloads/)
or by using `homebrew`.
or by using `homebrew`. After installing Julia, you will need to also install
these three packages: `JuMP, Cbc, NPZ`.

Data-Preparation Documentation and Workflow
-------------------------------------------
Expand Down
8 changes: 1 addition & 7 deletions createpuf.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ def dataprep(data):
print("Prepping PUF")
puf2011 = pd.read_csv(Path(DATA_PATH, "puf2011.csv"))
raw_puf = puf.preppuf(puf2011, PUF_YEAR)
# raw_puf.to_csv(Path(DATA_PATH, "raw_puf.csv"), index=False)

# rename CPS file to match PUF
print("Prepping CPS")
Expand All @@ -118,12 +117,6 @@ def dataprep(data):
raw_cps["e19800"] = raw_cps["charitable"] * cash
raw_cps["e20100"] = raw_cps["charitable"] * non_cash

# cap number of dependents in CPS to line up with PUF
# raw_cps["depne"] = np.where(
# raw_cps["mars"] == 2,
# np.minimum(5, raw_cps["depne"]),
# np.minimum(3, raw_cps["depne"]),
# )
raw_cps = dataprep(raw_cps)
raw_puf = dataprep(raw_puf)
raw_cps["recid"] = range(1, len(raw_cps.index) + 1)
Expand Down Expand Up @@ -166,6 +159,7 @@ def dataprep(data):
data.drop(list(data.filter(regex=".*_cps")), axis=1, inplace=True)
# add back non-filers
print("Adding non-filers")
nonfilers.rename(columns={"s006": "matched_weight"}, inplace=True)
data = pd.concat([data, nonfilers], sort=False, ignore_index=True)
data = data.fillna(0.0)
data.reset_index(inplace=True)
Expand Down
Binary file modified puf_stage2/puf_weights.csv.gz
Binary file not shown.
Loading