Skip to content

Instantly share code, notes, and snippets.

@toyeiei
Last active Nov 11, 2018
Embed
What would you like to do?
Case Study - US Births Analysis
# cleaing data
data = data.split("\n")
data = data[1:]
# see what data looks like
for row in data[:10]:
print(row)
# preliminary analysis
result = {}
for row in data:
year = row.split(",")[0] # year at index 0
birth = int(row.split(",")[4]) # birth at index 4
if year in result:
result[year] += birth
else:
result[year] = birth
# see result
print(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment