<jupyter_start><jupyter_text>Get State FIP Codes<jupyter_code>fips_url = 'https://gist.githubusercontent.com/dantonnoriega/bf1acd2290e15b91e6710b6fd3be0a53/raw/11d15233327c8080c9646c7e1f23052659db251d/us-state-ansi-fips.csv'

state_fips = pd.read_csv(fips_url)
state_fips = state_fips.rename(columns = {'stname': 'name', ' st': 'fip', ' stusps': 'abbr'})

fips = state_fips['fip'].astype(str)

for i in range(0, len(fips)):
    if len(fips[i]) < 2:
        fips[i] = '0' + fips[i]<jupyter_output><empty_output><jupyter_text>Get Demographic Variable Names<jupyter_code>dropbox_location = '~/Dropbox (Dartmouth College)/qss20_finalproj_rawdata/summerwork/intermediate/predictors_acs_varname.csv'

variables_df = pd.read_csv(dropbox_location)

variables_df = variables_df[variables_df.predictors == 'yes']

variables_list = variables_df.name.to_list()

variables_list = [x + 'E' for x in variables_list]
# The variable 'yE' is actually supposed to be 'B05006_123E' (Latin American population),
# so replace it and add 'NAME' variable

variables_list.remove('yE')

variables_list = ['NAME', 'B05006_123E'] + variables_list<jupyter_output><empty_output><jupyter_text>Get County Tract Demographic Variables For All States<jupyter_code>all_dem = demographics(variables_list)
all_dem<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12413793103448276, 'fraction_numerical': 0.05363984674329502, 'mean_word_length': 7.6490066225165565, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 13, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '574348', 'license': 'CC0-1.0', 'n_tokens_mistral': 551, 'n_tokens_neox': 506, 'n_words': 81, 'path': 'code/archive/04_acs_demographics_testing.ipynb', 'repo_name': 'rebeccajohnson88/qss20_s21_proj', 'size': '1305'}