Last active
August 21, 2019 00:54
-
-
Save mhornbacher/d8357e218f4d1725cc80b12fb178f06b to your computer and use it in GitHub Desktop.
Parser for Healthcare_Associated_Infections.csv file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
cities = dict() | |
counties = dict() | |
hosptials = dict() | |
with open('Healthcare_Associated_Infections.csv', 'r') as f: | |
reader = csv.reader(f, delimiter=",") | |
for i, row in enumerate(reader): | |
if i == 0: | |
continue | |
city = row[3] | |
county = row[6] | |
hospital = row[1] | |
if city in cities: | |
cities[city] += 1 | |
else: | |
cities[city] = 1 | |
if county in counties: | |
counties[county] += 1 | |
else: | |
counties[county] = 1 | |
if hospital in hosptials: | |
hosptials[hospital] += 1 | |
else: | |
hosptials[hospital] = 1 | |
print("Total Cities: " + str(len(cities))) | |
print("Total counties: " + str(len(counties))) | |
print("Total Hospitals: " + str(len(hosptials))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment