# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# + [markdown] toc=true
# <h1>Table of Contents<span class="tocSkip"></span></h1>
# <div class="toc" style="margin-top: 1em;"><ul class="toc-item"></ul></div>
# -

# %matplotlib inline
import pandas as pd
import numpy as np

# +
VARIABLE_NAMES_HGEN = {
    'hid': 'ID_HH',
    'syear': 'YEAR',
    'hghinc': 'HH_NET_INCOME_MONTHLY',
}

RETAINED_COLUMNS_HGEN = list(VARIABLE_NAMES_HGEN.keys())
# -

df = pd.read_stata('../data/hgen.dta', columns=RETAINED_COLUMNS_HGEN)
df = df.rename(columns=VARIABLE_NAMES_HGEN)
df.sort_values(['ID_HH', 'YEAR'], axis=0, inplace=True)

df.loc[df.HH_NET_INCOME_MONTHLY < 0, 'HH_NET_INCOME_MONTHLY'] = np.nan

df.HH_NET_INCOME_MONTHLY.hist(range=(0, 25000), bins=100)

(df.HH_NET_INCOME_MONTHLY * 12).hist(range=(0, 50000), bins=100)



StarcoderdataJupyterScriptsDedupFiltered