Skip to content

The Nobel Prize has been among the most prestigious international awards since 1901. Each year, awards are bestowed in chemistry, literature, physics, physiology or medicine, economics, and peace. In addition to the honor, prestige, and substantial prize money, the recipient also gets a gold medal with an image of Alfred Nobel (1833 - 1896), who established the prize.

The Nobel Foundation has made a dataset available of all prize winners from the outset of the awards from 1901 to 2023. The dataset used in this project is from the Nobel Prize API and is available in the nobel.csv file in the data folder.

In this project, you'll get a chance to explore and answer several questions related to this prizewinning data. And we encourage you then to explore further questions that you're interested in!

# Loading in required libraries
import pandas as pd
import seaborn as sns
import numpy as np

# Start coding here!
# Read in the Nobel Prize data (adjust the file path if necessary)
nobel = pd.read_csv('data/nobel.csv')

# 1. What is the most commonly awarded gender and birth country?
# Note: Use the 'sex' column for gender.
top_gender = nobel['sex'].value_counts().index[0]
top_country = nobel['birth_country'].value_counts().index[0]

print("Most common gender:", top_gender)
print("Most common birth country:", top_country)

# 2. Which decade had the highest ratio of US-born winners to total winners?
# Create a boolean column for US-born winners.
# (Adjust the string below if your dataset uses a different string for USA-born winners.)
nobel['usa_born_winner'] = nobel['birth_country'] == 'United States of America'
# Create a 'decade' column by rounding down the year to the nearest decade.
nobel['decade'] = (np.floor(nobel['year'] / 10) * 10).astype(int)
# For each decade, calculate the proportion of winners who were born in the U.S.
prop_usa_winners = nobel.groupby('decade', as_index=False)['usa_born_winner'].mean()
# Identify the decade with the highest proportion.
max_decade_usa = prop_usa_winners[
    prop_usa_winners['usa_born_winner'] == prop_usa_winners['usa_born_winner'].max()
]['decade'].values[0]

print("Decade with highest ratio of US-born winners:", max_decade_usa)

# 3. Which decade and Nobel Prize category combination had the highest proportion of female laureates?
# Create a boolean column for female winners.
nobel['female_winner'] = nobel['sex'] == 'Female'
# Group by both decade and category, then calculate the fraction of winners who are female.
prop_female_winners = nobel.groupby(['decade', 'category'], as_index=False)['female_winner'].mean()
# Identify the combination with the maximum female ratio.
max_idx = prop_female_winners['female_winner'].idxmax()
max_combo = prop_female_winners.loc[max_idx, ['decade', 'category']]
max_female_dict = {int(max_combo['decade']): max_combo['category']}

print("Decade and Category with highest proportion of female laureates:", max_female_dict)

# 4. Who was the first woman to receive a Nobel Prize, and in what category?
# Filter to only female winners, then sort by year to find the earliest record.
nobel_women = nobel[nobel['female_winner']]
first_woman_row = nobel_women.sort_values('year').iloc[0]
first_woman_name = first_woman_row['full_name']
first_woman_category = first_woman_row['category']

print("The first woman to receive a Nobel Prize was:", first_woman_name, "in the category of", first_woman_category)

# 5. Which individuals or organizations have won more than one Nobel Prize?
# Count the number of awards per full name, and then select those names that occur more than once.
counts = nobel['full_name'].value_counts()
repeat_list = list(counts[counts > 1].index)

print("Repeat winners (received more than one Nobel Prize):", repeat_list)