-
-
Save toyeiei/45c6c86906d13c80476a471f377092a6 to your computer and use it in GitHub Desktop.
Case Study - US Births Analysis
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
# 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