Python learners & researchers
Meet the Nobel laureates in Python
Malala Yousafzai was 17 when she won the Nobel Peace Prize. John Goodenough was 97 when he won for chemistry. Meet every laureate since 1901 with a few lines of Python: what each was honored for, how old they were and where they were born.
In [1] Read the file and count
rows = read_csv(args.nobel_csv)
# One row is one laureate and one prize. LaureateID is the
# same on every prize a laureate wins, so it counts each once.
people = [r for r in rows if r["LaureateType"] == "Person"]
laureates = {r["LaureateID"] for r in rows}
organizations = laureates - {r["LaureateID"] for r in people}
decades = sorted({decade(r) for r in rows})
by_decade = Counter((decade(r), r["AwardName"]) for r in rows)
- prizes
- 1,036
- people
- 1,000
- organizations
- 28
One row is one laureate and one prize, so the file has more rows than laureates: a few were honored more than once.
Every square is one laureate. Select one to meet them.
Each column is a decade, stacked by prize. Squares are people and circles are organizations. The first and last decades hold only the years so far: 1901 to 1909, and 2020 to 2026.
In [2] Compare the prizes
# Each prize category as a share of all prizes.
by_prize = Counter(r["AwardName"] for r in rows)
share = {prize: 100 * n / len(rows) for prize, n in by_prize.items()}
In [3] Who was honored more than once?
# A laureate honored more than once has more than one row.
prizes_of = defaultdict(list)
for r in rows:
prizes_of[r["LaureateID"]].append(r)
repeat = [won for won in prizes_of.values() if len(won) > 1]
repeat.sort(key=lambda won: won[0]["FullName"])
5 people and 2 organizations have more than one prize. Select one to read what each prize was for.
In [4] How old were they?
# AgeAtAward is Year minus BornYear. Organizations have no age.
ages = defaultdict(list)
for r in people:
ages[r["AwardName"]].append(r)
ages["All prizes"].append(r)
age = lambda r: int(r["AgeAtAward"])
youngest = min(people, key=age)
oldest = max(people, key=age)
The youngest was , 17. The oldest was , 97. Half were 61 or older.
Swipe sideways to see every age.
One dot for each prize to a person, placed at the age they reached in the award year. Scientists are often honored decades after the work; writers and economists later still.
In [5] The women
women = [r for r in people if r["Gender"] == "Female"]
women_by_decade = Counter(decade(r) for r in women)
people_by_decade = Counter(decade(r) for r in people)
first = min(women, key=lambda r: int(r["Year"]))
70 prizes have gone to 69 women. The first was in 1903. There were none in the 1950s. There have been 16 in the 2020s so far.
Swipe sideways to see every year.
One dot for each prize to a woman, by year. Select a dot to read who she is and what the prize was for.
In [6] Where were they born?
# BornCountry is the present-day country of the birthplace.
# AffiliationCountry is where the laureate worked when honored.
born = Counter(r["BornCountry"] for r in people if r["BornCountry"])
moved = Counter(r["BornCountry"] for r in people
if r["BornCountry"] and r["AffiliationCountry"]
and r["BornCountry"] != r["AffiliationCountry"])
top = sorted(born.items(), key=lambda item: (-item[1], item[0]))[:10]
Swipe the map sideways to see the rest.
One circle for each birthplace, larger where more laureates were born: 55 in New York, NY, United States. Select a circle to see who. Map: Natural Earth (public domain). 26 of the 1,000 people have no coordinates in the source.
| Born in | Prizes | Working in another country | |
|---|---|---|---|
| United States | 302 | 4 | |
| United Kingdom | 111 | 26 | |
| Germany | 86 | 24 | |
| France | 64 | 13 | |
| Japan | 31 | 7 | |
| Sweden | 30 | 3 | |
| Poland | 29 | 19 | |
| Russia | 29 | 11 | |
| Canada | 23 | 15 | |
| Italy | 20 | 8 |
The dark part of each bar is the prizes to people who were working in a different country from the one they were born in. Birth countries use present-day borders.
| Decade | Physics | Chemistry | Physiology or Medicine | Literature | Peace | Economic Sciences |
|---|---|---|---|---|---|---|
| 1900s | 13 | 9 | 11 | 10 | 14 | 0 |
| 1910s | 10 | 8 | 6 | 9 | 7 | 0 |
| 1920s | 12 | 10 | 11 | 10 | 11 | 0 |
| 1930s | 11 | 13 | 14 | 9 | 9 | 0 |
| 1940s | 7 | 9 | 14 | 6 | 7 | 0 |
| 1950s | 20 | 14 | 20 | 10 | 8 | 0 |
| 1960s | 17 | 15 | 25 | 11 | 9 | 2 |
| 1970s | 25 | 15 | 25 | 11 | 13 | 15 |
| 1980s | 22 | 21 | 23 | 10 | 11 | 10 |
| 1990s | 22 | 18 | 20 | 10 | 17 | 17 |
| 2000s | 28 | 25 | 26 | 10 | 14 | 20 |
| 2010s | 26 | 27 | 24 | 10 | 14 | 20 |
| 2020s | 18 | 18 | 16 | 7 | 10 | 17 |
| Prize | Prizes | Share |
|---|---|---|
| Physiology or Medicine | 235 | 22.7% |
| Physics | 231 | 22.3% |
| Chemistry | 202 | 19.5% |
| Peace | 144 | 13.9% |
| Literature | 123 | 11.9% |
| Economic Sciences | 101 | 9.7% |
| Laureate | Prizes |
|---|---|
| Frederick Sanger | Chemistry 1958; Chemistry 1980 |
| International Committee of the Red Cross | Peace 1917; Peace 1944; Peace 1963 |
| John Bardeen | Physics 1956; Physics 1972 |
| K. Barry Sharpless | Chemistry 2001; Chemistry 2022 |
| Linus Pauling | Chemistry 1954; Peace 1962 |
| Marie Curie | Physics 1903; Chemistry 1911 |
| Office of the United Nations High Commissioner for Refugees | Peace 1954; Peace 1981 |
| Prize | Youngest | Age | Oldest | Age | Median age |
|---|---|---|---|---|---|
| Physics | Lawrence Bragg | 25 | Arthur Ashkin | 96 | 56 |
| Chemistry | Frédéric Joliot | 35 | John B. Goodenough | 97 | 58 |
| Physiology or Medicine | Frederick G. Banting | 32 | Peyton Rous | 87 | 58 |
| Literature | Rudyard Kipling | 42 | Doris Lessing | 88 | 67 |
| Peace | Malala Yousafzai | 17 | Joseph Rotblat | 87 | 62 |
| Economic Sciences | Esther Duflo | 47 | Leonid Hurwicz | 90 | 67 |
| All prizes | Malala Yousafzai | 17 | John B. Goodenough | 97 | 61 |
| Decade | Women | All people |
|---|---|---|
| 1900s | 3 | 56 |
| 1910s | 1 | 38 |
| 1920s | 2 | 54 |
| 1930s | 3 | 55 |
| 1940s | 3 | 40 |
| 1950s | 0 | 71 |
| 1960s | 3 | 75 |
| 1970s | 4 | 103 |
| 1980s | 4 | 94 |
| 1990s | 7 | 101 |
| 2000s | 11 | 119 |
| 2010s | 13 | 117 |
| 2020s | 16 | 82 |
| Born in | Prizes | Working in another country |
|---|---|---|
| United States | 302 | 4 |
| United Kingdom | 111 | 26 |
| Germany | 86 | 24 |
| France | 64 | 13 |
| Japan | 31 | 7 |
| Sweden | 30 | 3 |
| Poland | 29 | 19 |
| Russia | 29 | 11 |
| Canada | 23 | 15 |
| Italy | 20 | 8 |
Make it your own
Build your own version.
The notebook cells above are exact excerpts from one script. It reads the CSV with Python’s standard library and prints every table on this page.
Read and copy the complete Python script
"""Meet the Nobel laureates: analyze MySafeInfo's complete Nobel Prize CSV.
Usage: python nobel-analysis.py nobelwinners.csv [--charts] [--json]
Counting uses only the standard library. Only --charts needs matplotlib. No network requests.
"""
import argparse
import csv
import json
import sys
from collections import Counter, defaultdict
from statistics import median
PRIZES = ["Physics", "Chemistry", "Physiology or Medicine", "Literature", "Peace", "Economic Sciences"]
def read_csv(path):
with open(path, encoding="utf-8-sig", newline="") as handle:
return list(csv.DictReader(handle))
def decade(row):
return int(row["Year"]) // 10 * 10
def analyze(rows):
# One row is one laureate and one prize. LaureateID is the
# same on every prize a laureate wins, so it counts each once.
people = [r for r in rows if r["LaureateType"] == "Person"]
laureates = {r["LaureateID"] for r in rows}
organizations = laureates - {r["LaureateID"] for r in people}
decades = sorted({decade(r) for r in rows})
by_decade = Counter((decade(r), r["AwardName"]) for r in rows)
# Each prize category as a share of all prizes.
by_prize = Counter(r["AwardName"] for r in rows)
share = {prize: 100 * n / len(rows) for prize, n in by_prize.items()}
# A laureate honored more than once has more than one row.
prizes_of = defaultdict(list)
for r in rows:
prizes_of[r["LaureateID"]].append(r)
repeat = [won for won in prizes_of.values() if len(won) > 1]
repeat.sort(key=lambda won: won[0]["FullName"])
# AgeAtAward is Year minus BornYear. Organizations have no age.
ages = defaultdict(list)
for r in people:
ages[r["AwardName"]].append(r)
ages["All prizes"].append(r)
age = lambda r: int(r["AgeAtAward"])
youngest = min(people, key=age)
oldest = max(people, key=age)
women = [r for r in people if r["Gender"] == "Female"]
women_by_decade = Counter(decade(r) for r in women)
people_by_decade = Counter(decade(r) for r in people)
first = min(women, key=lambda r: int(r["Year"]))
# BornCountry is the present-day country of the birthplace.
# AffiliationCountry is where the laureate worked when honored.
born = Counter(r["BornCountry"] for r in people if r["BornCountry"])
moved = Counter(r["BornCountry"] for r in people
if r["BornCountry"] and r["AffiliationCountry"]
and r["BornCountry"] != r["AffiliationCountry"])
top = sorted(born.items(), key=lambda item: (-item[1], item[0]))[:10]
return {
"prizes": len(rows), "laureates": len(laureates), "people": len(laureates) - len(organizations),
"organizations": len(organizations), "women_laureates": len({r["LaureateID"] for r in women}),
"youngest": [youngest["FullName"], age(youngest), int(youngest["Year"])],
"oldest": [oldest["FullName"], age(oldest), int(oldest["Year"])],
"first_woman": [first["FullName"], int(first["Year"])],
"decades": {"columns": ["Decade"] + PRIZES, "rows": [[f"{d}s"] + [by_decade[d, p] for p in PRIZES] for d in decades]},
"share": {"columns": ["Prize", "Prizes", "Share"],
"rows": [[p, n, f"{share[p]:.1f}%"] for p, n in sorted(by_prize.items(), key=lambda item: (-item[1], item[0]))]},
"repeat": {"columns": ["Laureate", "Prizes"],
"rows": [[won[0]["FullName"], "; ".join(f"{r['AwardName']} {r['Year']}" for r in won)] for won in repeat]},
"ages": {"columns": ["Prize", "Youngest", "Age", "Oldest", "Age", "Median age"],
"rows": [[p, min(ages[p], key=age)["FullName"], age(min(ages[p], key=age)),
max(ages[p], key=age)["FullName"], age(max(ages[p], key=age)),
f"{median(age(r) for r in ages[p]):g}"] for p in PRIZES + ["All prizes"]]},
"women": {"columns": ["Decade", "Women", "All people"], "rows": [[f"{d}s", women_by_decade[d], people_by_decade[d]] for d in decades]},
"born": {"columns": ["Born in", "Prizes", "Working in another country"], "rows": [[c, n, moved[c]] for c, n in top]},
}
def charts(report):
import matplotlib.pyplot as plt
colors = ["#2a78d6", "#eb6834", "#1baf7a", "#eda100", "#e87ba4", "#008300"]
fig, axes = plt.subplots(2, 2, figsize=(16, 11), layout="constrained")
table = report["decades"]
labels = [r[0] for r in table["rows"]]
bottom = [0] * len(labels)
for i, prize in enumerate(table["columns"][1:]):
values = [r[i + 1] for r in table["rows"]]
axes[0, 0].bar(labels, values, bottom=bottom, label=prize, color=colors[i], edgecolor="white")
bottom = [a + b for a, b in zip(bottom, values)]
axes[0, 0].set_title("Prizes by decade")
axes[0, 0].tick_params(axis="x", rotation=60)
axes[0, 0].legend(fontsize=8)
table = report["share"]["rows"]
axes[0, 1].pie([r[1] for r in table], labels=[f"{r[0]} ({r[1]})" for r in table], autopct="%.1f%%",
colors=[colors[PRIZES.index(r[0])] for r in table], wedgeprops={"width": .45, "edgecolor": "white"})
axes[0, 1].set_title("Share of prizes")
table = report["women"]["rows"]
axes[1, 0].bar([r[0] for r in table], [r[2] - r[1] for r in table], label="Men", color="#c9d3dd")
axes[1, 0].bar([r[0] for r in table], [r[1] for r in table], bottom=[r[2] - r[1] for r in table], label="Women", color=colors[4])
axes[1, 0].set_title("Prizes to women and men by decade")
axes[1, 0].tick_params(axis="x", rotation=60)
axes[1, 0].legend()
table = report["born"]["rows"][::-1]
axes[1, 1].barh([r[0] for r in table], [r[1] for r in table], color="#c9d3dd", label="Prizes to people born there")
axes[1, 1].barh([r[0] for r in table], [r[2] for r in table], color=colors[0], label="Working in another country")
axes[1, 1].set_title("Where laureates were born")
axes[1, 1].legend()
plt.show()
if __name__ == "__main__":
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("nobel_csv")
parser.add_argument("--charts", action="store_true")
parser.add_argument("--json", action="store_true", help="Print machine-readable tables for comparison")
args = parser.parse_args()
sys.stdout.reconfigure(encoding="utf-8")
rows = read_csv(args.nobel_csv)
result = analyze(rows)
if args.json:
print(json.dumps(result, ensure_ascii=False))
else:
print(f"{result['prizes']:,} prizes to {result['laureates']:,} laureates: {result['people']:,} people and {result['organizations']} organizations")
print("Youngest: {} ({}, {}). Oldest: {} ({}, {}).".format(*result["youngest"], *result["oldest"]))
print("First woman: {} ({}). {} women so far.".format(*result["first_woman"], result["women_laureates"]))
for key in ["repeat", "decades", "share", "ages", "women", "born"]:
print("\n" + key.upper())
writer = csv.writer(sys.stdout, delimiter="\t", lineterminator="\n")
writer.writerow(result[key]["columns"])
writer.writerows(result[key]["rows"])
if args.charts:
charts(result)
Run it in three steps
-
Download the script and the CSV
Save nobel-analysis.py and nobelwinners.csv in the same folder. The CSV is UTF-8, so names such as Röntgen and Skłodowska arrive intact.
-
Run the analysis
python nobel-analysis.py nobelwinners.csvIt prints the counts, the laureates honored more than once, and the decade, share, age, women and birthplace tables. It needs Python 3.9 or later and no packages.
-
Draw the charts if you want to
python -m pip install matplotlib python nobel-analysis.py nobelwinners.csv --chartsThe optional charts use matplotlib to draw four of the tables. The counts do not depend on it.
Questions to answer next
- Which city has produced the most laureates? Count
BornCityandBornCountrytogether, once for eachLaureateID. - Who lived longest after the prize? Subtract
Yearfrom the year inDied. - Are prizes shared more often now? Average
Laureatesby decade for each category. - What is the prize worth? Chart
PrizeAmountAdjustedby year, then multiply bySharefor one laureate’s part. - Which university appears most? Count
Affiliation, and compare it withAffiliationCountry.
Data notes
One row is one laureate and one prize. A person honored twice has two rows with the same LaureateID. Count rows for prizes and distinct LaureateID values for laureates.
Places use present-day names. BornCity, BornCountry and Country name the birthplace as it is today, so that countries can be counted. BornPlace keeps the Nobel Foundation’s wording, such as “Warsaw, Russian Empire (now Poland)”. Three people have no birthplace in the source.
Age is counted in whole years. AgeAtAward is the award year minus the year of birth, so it is the age the laureate reached that year.
Affiliation is where the laureate worked when honored. It is the first institution the source lists. Most Literature and Peace laureates have none, so “working in another country” counts only laureates who have one.
The records come from the Nobel Prize API (opens in a new tab), which Nobel Prize Outreach publishes under CC0. Each row’s Url opens that laureate’s page on NobelPrize.org.
Questions
Why are there more prizes than laureates?
A few laureates were honored more than once. Marie Curie has a row for Physics in 1903 and another for Chemistry in 1911, and the International Committee of the Red Cross has three.
Can I count unique people by FullName?
Use LaureateID. Names are not identifiers: two people can share one, and spellings vary between sources.
Does the data include the prize money?
Yes. PrizeAmount is the whole prize for that category and year in Swedish kronor, and PrizeAmountAdjusted restates it in recent money. Share is the laureate’s part of it.
Why do some rows have only a birth year?
The source gives no month or day for some living laureates. Born then holds the year alone, and BornYear is always filled for a person.
Free in full. No Data Pass or API key needed. Opening this guide does not use your API allowance.
What each record contains
Explore the dataset and its sources. These fields are in the complete download.
| Field | How to read it |
|---|---|
Year |
Award year. |
Country |
Two-letter ISO code of the present-day country of birth; for an organization, where it was founded. Blank where the source has no place. |
FullName |
The laureate’s name as the Nobel Foundation writes it, or the organization’s name. |
AwardName |
Prize category: Physics, Chemistry, Physiology or Medicine, Literature, Peace or Economic Sciences. |
LaureateType |
Person or Organization. |
Gender |
Female or Male; blank for an organization. |
Born |
Date of birth as YYYY-MM-DD, or the year alone where the source has no month or day. Keep as text. |
BornYear |
Year of birth; always filled for a person. |
BornCity |
City of birth under its present-day name. |
BornCountry |
Present-day country of the birthplace, written as in the Countries dataset. |
BornPlace |
The birthplace in the Nobel Foundation’s words, including the country at the time: Warsaw, Russian Empire (now Poland). |
BornContinent |
Continent of the birthplace. |
BornLatitude |
Coordinates of the present-day city of birth, in decimal degrees; blank where the source has none. |
BornLongitude |
Coordinates of the present-day city of birth, in decimal degrees; blank where the source has none. |
Died |
Date of death as YYYY-MM-DD; blank for a living laureate. |
DiedCity |
Place of death under present-day names; blank for a living laureate. |
DiedCountry |
Place of death under present-day names; blank for a living laureate. |
Founded |
For an organization: the year and country where it was founded. |
FoundedCountry |
For an organization: the year and country where it was founded. |
AgeAtAward |
Year minus BornYear: the age the laureate reached in the award year. Blank for an organization. |
Motivation |
The official citation, in English: what the prize was awarded for. |
Share |
This laureate’s part of the prize: 1, 1/2, 1/3 or 1/4. Keep as text. |
Laureates |
How many laureates shared that year’s prize in the category. |
Status |
Received, Declined, or Not allowed to accept. |
Affiliation |
The first institution the source lists for the laureate at the time of the award; blank for most Literature and Peace laureates. |
AffiliationCity |
Where that institution is, under present-day names. |
AffiliationCountry |
Where that institution is, under present-day names. |
AffiliationLatitude |
Coordinates of the institution’s city, in decimal degrees. |
AffiliationLongitude |
Coordinates of the institution’s city, in decimal degrees. |
PrizeAmount |
The whole prize for that category and year, in Swedish kronor as paid. Multiply by Share for one laureate’s part. |
PrizeAmountAdjusted |
The same prize restated by the Nobel Foundation in recent Swedish kronor. |
LaureateID |
The Nobel Foundation’s number for the laureate. It is the same on every prize a laureate has won, so count it for laureates. |
Url |
The laureate’s page on NobelPrize.org. |
Wikipedia |
The laureate’s English Wikipedia article. |
Working with the download? Convert CSV to JSON, or turn a column into a list with the comma separator.
For your next project
More subjects to build with.
Nobel winners are free in full. The Data Pass covers the rest of the catalog.
The Data Pass includes complete downloads and API access across the catalog.