<jupyter_start><jupyter_text>This script combines the ACS 5 year Census data pulled by block groupNote the directory paths needed for reading and writing the files.  Note, ACS 5 year detailed tables are not available at the block group level for the years 2010, 2011, and 2012.<jupyter_code>import pandas as pd
data09 = pd.read_csv('Clean/BlockGroupClean/2009.txt')
data09['Year'] = 2009

data13 = pd.read_csv('Clean/BlockGroupClean/2013.txt')
data13['Year'] = 2013

data14 = pd.read_csv('Clean/BlockGroupClean/2014.txt')
data14['Year'] = 2014

data15 = pd.read_csv('Clean/BlockGroupClean/2015.txt')
data15['Year'] = 2015

data16 = pd.read_csv('Clean/BlockGroupClean/2016.txt')
data16['Year'] = 2016

data17 = pd.read_csv('Clean/BlockGroupClean/2017.txt')
data17['Year'] = 2017
frames = [data09, data13, data14, data15, data16, data17]
df_bg = pd.concat(frames)
df_bg.describe()
df_bg.head()
df_bg.columns = ['TotalPop', 'TPopMargin', 'UnWgtSampleCtPop', 'PerCapitaIncome', 'PerCapIncMargin', 'MedianHouseholdInc', 'MedHouseholdIncMargin', 'MedianAge', 'MedianAgeMargin', 'HousingUnits', 'HousingUnitsMargin', 'UnweightedSampleHousingUnits', 'State', 'County', 'Tract', 'BlockGroup', 'Year']
df_bg.head()
df_bg['TotalPop'].describe()
df_bg.to_csv(r'Clean/BlockGroupClean/BlockGroupData.csv')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14307342922028765, 'fraction_numerical': 0.07418622255866768, 'mean_word_length': 7.2625, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '567268', 'license': 'MIT', 'n_tokens_mistral': 538, 'n_tokens_neox': 455, 'n_words': 103, 'path': 'notebooks/.ipynb_checkpoints/EDA_Census_BG-checkpoint.ipynb', 'repo_name': 'georgetown-analytics/DC-Criminalistics', 'size': '1321'}