In [1]:
import seaborn as sns
import metapack as mp
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from IPython.display import display 

import publicdata.chis as chis

from rowgenerators import parse_app_url

%matplotlib inline
sns.set_context('notebook')

In [2]:
#pkg = mp.jupyter.open_package()
pkg = mp.jupyter.open_source_package()
pkg


Out[2]:

CHIS California Health Interview Survey, Adults

healthpolicy.ucla.edu-chis-adult-1 Last Update: 2018-12-07T00:50:35

Documentation and Reference Links to CHIS files.

CHIS Data packages

Using these file requires accepting the terms and restrictions provided by the UCLA Center for Health Policy Research. These terms are available online, and reproduced here:

Restrictions on the Use of California Health Interview Survey Data Before you
download this file, you must first agree to these Restrictions on the Use of
CHIS Data by clicking the button below.

The California Health Interview Survey (CHIS) is bound by promises made to
respondents, by California law, and by University and government human subject
protection committees to assure that no personal information is released in a
form that identifies an individual without the consent of the person who
supplied the information. The California Information Practices Act (section
1798.24) provides that the data collected by CHIS may be released only for
statistical research and reporting purposes. Any intentional identification or
disclosure of personal information violates this law, and violates the privacy
rights of the people who provided data to CHIS. Unauthorized disclosure of
personal information is subject to civil action and penalties for invasion of
privacy under California Civil Code, Section 1798.53.

Documentation Links

Contacts

Resources

  • rasp_diabetes. Diabetes probabilities for age, race, sex, and poverty level ratio, for all CHIS respondents in California

References


In [3]:
df17 = pkg.reference('adult_2017').dataframe()
df16 = pkg.reference('adult_2016').dataframe()
df15 = pkg.reference('adult_2015').dataframe()
df14 = pkg.reference('adult_2014').dataframe()
df13 = pkg.reference('adult_2013').dataframe()

all_sets =  [df13,df14,df15,df16,df17]

for df, year in zip(all_sets, range(2013, 2018)):
    df['year'] = year
    
    df = chis.recode(df)
    
# What are the columns common to all datasets?
from operator import and_, or_
from functools import reduce

common_cols = list(reduce(and_, [e.columns for e in all_sets]))

n_years, df = chis.concat(all_sets, common_cols + ['urminority','poor','old','race_recode'])

In [ ]: