<jupyter_start><jupyter_text>51_mapping_HH_median_income This page is for constructing dataframes that can be loaded into Tableau<jupyter_code># imports
import pandas as pd
import requests
import pickle as p
import matplotlib.pyplot as plt
# pd.set_option('display.max_columns', None)
# pd.set_option('display.max_rows', None)
#precints18 URL:  https://public.tableau.com/profile/neva7752#!/vizhome/srprec_g12_cty059/srprec2018?publish=yes
#URL mentions g12, but map is for 2018 precints<jupyter_output><empty_output><jupyter_text>Test:  Load one column of agg data<jupyter_code>map1 = pd.read_pickle('./data/combined18.pkl')
map1.shape
map1.head()
map1.info()
map1 = map1[['srprec_orig', 'hh_med_inc_wgt']]
map1['srprec_orig'] = map1['srprec_orig'].astype('int')

map1.info()
map1['srprec_orig'] = map1['srprec_orig'].astype('string')

map1.head()
map1.info()
#Tableau found negative values, prevents creation of bins.  
# look for negative income values
map1.loc[map1['hh_med_inc_wgt'] <= 0]
# There are six precincts with negative income, out of 1,334 (<0.5% of rows).
# ok to drop for map-test
map1 = map1.loc[map1['hh_med_inc_wgt'] > 0]
map1.shape
map1.head()
map1.to_csv('./map_files/map1.csv')
# load csv into Tableau ... see if the precincts line up<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13131313131313133, 'fraction_numerical': 0.042735042735042736, 'mean_word_length': 6.318181818181818, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 10, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '487214', 'license': 'CC0-1.0', 'n_tokens_mistral': 516, 'n_tokens_neox': 483, 'n_words': 113, 'path': '51_mapping_HHMedInc.ipynb', 'repo_name': 'git-nmf/Orange_County_Voting_Trends', 'size': '1287'}