Python learners & researchers

Explore Nobel Prize data in Python

Read the complete CSV, count distinct laureate-prizes, and explore the decades, prizes and countries.

Select a colored segment to see its prize and count.

nobel-analysis.py All cells completed

In [1] Read and count

rows = read_csv(args.nobel_csv)
unique = {(r["Year"], r["AwardName"], r["FullName"]): r for r in rows}
Out [1]

1,098 rows → 1,046 laureate-prizes

Several country associations can describe the same award to the same recipient. Count each laureate-prize once.

In [2] Group by decade and prize

prizes = sorted({r["AwardName"] for r in laureates})
decades = sorted({int(r["Year"]) // 10 * 10 for r in laureates})
counts = Counter((int(r["Year"]) // 10 * 10, r["AwardName"]) for r in laureates)
Out [2]
1900s
1910s
1920s
1930s
1940s
1950s
1960s
1970s
1980s
1990s
2000s
2010s
2020s
Chemistry Economic Sciences Literature Peace Physics Physiology or Medicine

Stacked columns count distinct laureate-prizes; each color is a prize category. The first and last decades include only recorded years.

In [3] Compare shares by prize

by_prize = Counter(r["AwardName"] for r in laureates)
Out [3]

Each segment is a category’s share of the distinct laureate-prize total.

In [4] Join country codes to names

names = {r["CountryAlpha2"]: r["CountryName"] for r in countries}
by_country = Counter(names.get(r["Country"], r["Country"]) for r in rows)
Out [4]

The ten largest country-association counts retain every source row, rather than deduplicating laureate-prizes.

Laureate-prizes by decade
Decade Chemistry Economic Sciences Literature Peace Physics Physiology or Medicine
1900s 9 0 10 14 16 11
1910s 9 0 9 5 10 5
1920s 10 0 10 11 12 11
1930s 13 0 9 8 11 14
1940s 9 0 7 6 7 15
1950s 13 0 10 7 20 21
1960s 16 2 11 5 18 26
1970s 16 17 11 13 27 26
1980s 22 10 11 9 22 24
1990s 21 18 11 17 22 20
2000s 25 20 11 12 28 28
2010s 27 20 10 12 26 24
2020s 18 17 7 10 18 16
Share of laureate-prizes
Prize Laureate-prizes Share
Physiology or Medicine 241 23.0%
Physics 237 22.7%
Chemistry 208 19.9%
Peace 129 12.3%
Literature 127 12.1%
Economic Sciences 104 9.9%
Top countries by association
Country Associations
United States 411
United Kingdom 128
Germany 99
France 72
Japan 29
Sweden 29
Canada 25
Switzerland 25
Italy 22
Russia 21

Make it your own

Build your own version.

The notebook cells above show exact excerpts from the downloadable script’s read_csv and analyze functions. The complete file supplies their shared context and optional matplotlib charts.

Download nobel-analysis.py
Read and copy the complete Python script
"""Analyze MySafeInfo's complete Nobel CSV; country rows are associations, not people.
Usage: python nobel-analysis.py nobelwinners.csv countries.csv [--charts] [--json]
Only --charts needs a third-party package (matplotlib). No network requests.
"""
import argparse
import csv
import json
from collections import Counter, defaultdict


def read_csv(path):
    with open(path, encoding="utf-8-sig", newline="") as handle:
        return list(csv.DictReader(handle))


def analyze(rows, countries):
    # A laureate-prize may occur several times because it has several countries.
    unique = {(r["Year"], r["AwardName"], r["FullName"]): r for r in rows}
    laureates = list(unique.values())
    names = {r["CountryAlpha2"]: r["CountryName"] for r in countries}
    prizes = sorted({r["AwardName"] for r in laureates})
    decades = sorted({int(r["Year"]) // 10 * 10 for r in laureates})
    counts = Counter((int(r["Year"]) // 10 * 10, r["AwardName"]) for r in laureates)
    by_prize = Counter(r["AwardName"] for r in laureates)
    by_country = Counter(names.get(r["Country"], r["Country"]) for r in rows)
    events = defaultdict(set)
    for r in laureates:
        events[(int(r["Year"]), r["AwardName"])].add(r["FullName"])
    solo = Counter(year // 10 * 10 for (year, _), people in events.items() if len(people) == 1)
    shared = Counter(year // 10 * 10 for (year, _), people in events.items() if len(people) > 1)
    last = max(int(r["Year"]) for r in laureates)
    missing = []
    for prize in prizes:
        years = {int(r["Year"]) for r in laureates if r["AwardName"] == prize}
        missing.append([prize, ", ".join(str(y) for y in range(min(years), last + 1) if y not in years)])
    return {
        "associations": len(rows), "laureate_prizes": len(laureates),
        "decades": {"columns": ["Decade"] + prizes, "rows": [[str(d) + "s"] + [counts[d, p] for p in prizes] for d in decades]},
        "share": {"columns": ["Prize", "Laureate-prizes", "Share"], "rows": [[p, n, f"{100*n/len(laureates):.1f}%"] for p, n in sorted(by_prize.items(), key=lambda x: (-x[1], x[0]))]},
        "countries": {"columns": ["Country", "Associations"], "rows": [[p, n] for p, n in sorted(by_country.items(), key=lambda x: (-x[1], x[0]))[:10]]},
        "shared": {"columns": ["Decade", "Solo", "Shared"], "rows": [[str(d) + "s", solo[d], shared[d]] for d in decades]},
        "missing": {"columns": ["Prize", "Years"], "rows": missing},
    }


def charts(report):
    import matplotlib.pyplot as plt
    colors = ["#426b90", "#b08a57", "#668572", "#766b93", "#537e87", "#98796c"]
    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], hatch=["", "//", "..", "xx", "\\\\", "++"][i])
        bottom = [a + b for a, b in zip(bottom, values)]
    axes[0, 0].set_title("Laureate-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, wedgeprops={"width": .45})
    axes[0, 1].set_title("Share of laureate-prizes")
    table = report["countries"]["rows"]
    axes[1, 0].barh([r[0] for r in table][::-1], [r[1] for r in table][::-1], color=colors[0])
    axes[1, 0].set_title("Top countries by association")
    table = report["shared"]["rows"]
    axes[1, 1].bar([r[0] for r in table], [r[1] for r in table], label="Solo", color=colors[0])
    axes[1, 1].bar([r[0] for r in table], [r[2] for r in table], bottom=[r[1] for r in table], label="Shared", color=colors[1], hatch="//")
    axes[1, 1].set_title("Solo and shared prize events")
    axes[1, 1].tick_params(axis="x", rotation=60)
    axes[1, 1].legend()
    plt.show()


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("nobel_csv")
    parser.add_argument("countries_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()
    rows = read_csv(args.nobel_csv)
    result = analyze(rows, read_csv(args.countries_csv))
    if args.json:
        print(json.dumps(result, ensure_ascii=False))
    else:
        print(f"{result['associations']:,} country associations; {result['laureate_prizes']:,} distinct laureate-prizes")
        for key in ["decades", "share", "countries", "shared", "missing"]:
            print("\n" + key.upper())
            writer = csv.writer(__import__("sys").stdout, delimiter="\t")
            writer.writerow(result[key]["columns"])
            writer.writerows(result[key]["rows"])
    if args.charts:
        charts(result)

First, check what a row means

A row is a laureate–country association. Count distinct (Year, AwardName, FullName) for laureate-prizes. Count rows for country associations. Neither is the number of unique people across all years: repeat laureates and organizations need different treatment.

  1. Download both complete CSVs

    Save nobelwinners.csv and countries.csv beside the script. Keep UTF-8 names intact. The country join is Nobel Country → Countries CountryAlpha2.

  2. Run the standard-library analysis

    python nobel-analysis.py nobelwinners.csv countries.csv

    The script prints these decade, category-share and country-association tables, plus solo/shared and missing-year tables. It needs no packages for counting.

  3. Draw the charts if you want to

    python -m pip install matplotlib
    python nobel-analysis.py nobelwinners.csv countries.csv --charts

    The optional section uses matplotlib to draw the same groups. The counts do not depend on that library.

Data notes

Country associations are not a measure of birthplace, citizenship or research location unless the source explicitly says so. A person with two associated countries contributes two rows but one laureate-prize. A solo prize event has one distinct laureate in that year and category; a shared event has more than one. This does not infer award fractions.

The missing-year table spans each category's first recorded year through the dataset's latest year. Absence is not, by itself, proof that a war caused an interruption. Read the Nobel Foundation's facts and award history (opens in a new tab) before explaining a gap. Economic Sciences has a different starting history from the original prizes.

Use Country codes to check imported country identifiers and Join CSV files to practice the name lookup without Python.

Questions

Why do the country bars add to more than the laureate-prize count?

A laureate-prize can be associated with more than one country. Those bars count associations and deliberately retain every row.

Can I count unique people by FullName?

It is a useful starting point, but names are not durable person identifiers and some recipients are organizations. Define your question and inspect collisions or name changes first.

Why not sum the Nobel Prize money from this data?

The file does not contain monetary values or award fractions. That question needs another source.

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.

FieldHow to read it
Year Award year. Combine with AwardName and FullName to identify a laureate-prize.
Country ISO alpha-2 country association. A laureate-prize can have several rows.
FullName Laureate or organization as recorded; a person can receive more than one prize.
AwardName Prize category, including Economic Sciences.

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 and Countries 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.

Data Pass

$69one payment / 365 days

Explore the Data Pass

No account required. No automatic renewal.