<jupyter_start><jupyter_text>Learned data structures and methodsneed visualization methods<jupyter_code># second dataset
import pprint as pp

f1 = open("census.csv", "r")
reader = csv.reader(f1)
census = list(reader)

pp.pprint(census)
# the rate of gun deaths per 100000 people for each racial category
mapping = {
    'Black': 40250635,
    'Asian/Pacific Islander': 15159516,
    'White': 197318956,
    'Native American/Native Alaskan': 3739506,
    'Hispanic': 44618105
}

race_per_hundredk = {}
for race, val in race_counts.items():
    race_per_hundredk[race] = val/mapping[race] * 100000

print(race_per_hundredk)
# filtering by intent
intents = [row[3] for row in data]
races = [row[7] for row in data]

homicide_race_counts = {}

for i, race in enumerate(races):
    if intents[i] == 'Homicide':
        if race not in homicide_race_counts:
            homicide_race_counts[race] = 1
        else:
            homicide_race_counts[race] += 1
            
for race, val in homicide_race_counts.items():
    homicide_race_counts[race] = val/mapping[race] * 100000
    
print(homicide_race_counts)<jupyter_output>{'Asian/Pacific Islander': 3.687452818414519, 'Native American/Native Alaskan': 8.717729026240365, 'White': 4.6356417981453335, 'Black': 48.471284987180944, 'Hispanic': 12.627161104219914}
{'fraction_non_alphanumeric': 0.11162079510703364, 'fraction_numerical': 0.11238532110091744, 'mean_word_length': 4.3428571428571425, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '308072', 'license': 'MIT', 'n_tokens_mistral': 596, 'n_tokens_neox': 467, 'n_words': 112, 'path': 'Basics.ipynb', 'repo_name': 'AlexIvamoto/Exploring-guns-data', 'size': '1308'}