Skip to content

Instantly share code, notes, and snippets.

@toyeiei
Last active November 11, 2018 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toyeiei/45c6c86906d13c80476a471f377092a6 to your computer and use it in GitHub Desktop.
Save toyeiei/45c6c86906d13c80476a471f377092a6 to your computer and use it in GitHub Desktop.
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