Created
December 31, 2025 13:38
-
-
Save mroy-seedbox/c11700f0df5f17ccc05239ff1d2b2ed7 to your computer and use it in GitHub Desktop.
Most popular American names
This file contains hidden or 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
| # Download names from https://www.ssa.gov/oact/babynames/limits.html | |
| y = 1960 | |
| names = {} | |
| MIN_COUNT = 500 | |
| MIN_LENGTH = 2 | |
| while y < 2025: | |
| with open(f"./yob{y}.txt", 'r') as f: | |
| lines = f.readlines() | |
| for l in lines: | |
| [name, gender, count] = l.strip().split(",") | |
| count = names.get(name, 0) + int(count) | |
| names[name] = count | |
| y+=1 | |
| names = sorted(names.items(), key=lambda x: x[1], reverse=True) | |
| names = [n[0] for n in names if n[1] >= MIN_COUNT and len(n[0]) > MIN_LENGTH] | |
| with open("./yobALL.txt", 'w') as f: | |
| f.write("\n".join(names)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment