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
# Load the Nobel Prize dataset
nobel_data = pd.read_csv('data/nobel.csv')

# Check the first few rows of the dataset
print(nobel_data.head())
# Check the column names in the dataset
print(nobel_data.columns)



#What is the most commonly awarded gender and birth country?
# Identify the most commonly awarded gender and birth country
top_gender = nobel_data['sex'].mode()[0]  # Mode gives the most frequent value
top_country = nobel_data['birth_country'].mode()[0]

# Print the results
print(f"The most commonly awarded gender is: {top_gender}")
print(f"The most commonly awarded birth country is: {top_country}")
# Which decade had the highest ratio of US-born Nobel Prize winners to total winners in all categories?
# Make sure the 'year' column is in the correct format
nobel_data['year'] = pd.to_numeric(nobel_data['year'], errors='coerce')

# Create the 'decade' column by extracting the first year of each decade
nobel_data['decade'] = (nobel_data['year'] // 10) * 10

# Clean up the 'birth_country' column
nobel_data['birth_country'] = nobel_data['birth_country'].str.strip()

# Filter for US-born winners
us_winners = nobel_data[nobel_data['birth_country'] == 'United States of America']

# Group by decade and count the total winners and US-born winners per decade
total_winners_by_decade = nobel_data.groupby('decade').size()
us_winners_by_decade = us_winners.groupby('decade').size()

# Calculate the ratio of US-born winners to total winners in each decade
us_ratio_by_decade = us_winners_by_decade / total_winners_by_decade

# Find the decade with the highest ratio
max_decade_usa = us_ratio_by_decade.idxmax()

# Print the result
print(f"The decade with the highest proportion of US-born Nobel Prize winners is: {max_decade_usa}")
#Which decade and Nobel Prize category combination had the highest proportion of female laureates?
# Standardize the 'sex' column to lowercase and drop rows with nan values
nobel_data['sex'] = nobel_data['sex'].str.lower()

# Now filter for female laureates
female_nobel = nobel_data[nobel_data['sex'] == 'female']

# Check the first few rows of female_nobel
print(female_nobel.head())

# Standardize the 'sex' column to lowercase and drop rows with nan values
nobel_data['sex'] = nobel_data['sex'].str.lower()

# Filter for female laureates
female_nobel = nobel_data[nobel_data['sex'] == 'female']

# Group by decade and category to calculate the number of female laureates
female_counts = female_nobel.groupby(['decade', 'category']).size()

# Group by decade and category to calculate the total number of laureates
total_counts = nobel_data.groupby(['decade', 'category']).size()

# Calculate the proportion of female laureates for each group
female_proportions = female_counts / total_counts

# Find the decade and category combination with the highest proportion of female laureates
max_female_decade_category = female_proportions.idxmax()

# Store the result as a dictionary
max_female_dict = {max_female_decade_category[0]: max_female_decade_category[1]}

# Print the result
print(max_female_dict)


# Who was the first woman to receive a Nobel Prize, and in what category?
# Filter for female laureates
female_nobel = nobel_data[nobel_data['sex'] == 'female']

# Sort by year to find the first female laureate
first_female = female_nobel.sort_values('year').iloc[0]

# Extract the name and category of the first female laureate
first_woman_name = first_female['full_name']
first_woman_category = first_female['category']

# Print the results
print(f"First woman to receive a Nobel Prize: {first_woman_name}")
print(f"Category: {first_woman_category}")
#Which individuals or organizations have won more than one Nobel Prize throughout the years?
# Group by 'full_name' and count the number of occurrences (prizes) for each laureate
repeat_winners = nobel_data.groupby('full_name').size()

# Filter out laureates who have won more than one Nobel Prize
repeat_winners = repeat_winners[repeat_winners > 1]

# Store the full names of laureates who have won more than one Nobel Prize
repeat_list = repeat_winners.index.tolist()

# Print the repeat_list
print(repeat_list)