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!
nobel = pd.read_csv("data/nobel.csv")
nobel.head()# What is the most commonly awarded gender?
top_gender = nobel['sex'].value_counts().idxmax()
top_gender# What is the most commonly awarded birth country?
top_country = nobel['birth_country'].value_counts().idxmax()
top_country# Which decade had the highest ratio of US-born Nobel Prize winners to total winners in all categories?
decade_col = (nobel['year'] // 10) * 10
decade_col# Add a 'decade' column if it doesn't exist
if 'decade' not in nobel.columns:
nobel['decade'] = (nobel['year'] // 10) * 10
# count US-born Nobel Prize winners
usa_ratio = (nobel[nobel['birth_country'] == 'United States of America']
.groupby('decade')['laureate_id']
.count() / nobel.groupby('decade')['laureate_id'].count())
usa_ratio# maximum decade in usa
max_decade_usa = usa_ratio.idxmax()
max_decade_usa# Which decade and Nobel Prize category combination had the highest proportion of female laureates?
female_prop = (nobel[nobel['sex'] == 'Female']
.groupby(['decade', 'category'])['laureate_id']
.count() / nobel.groupby(['decade', 'category'])['laureate_id'].count()).to_dict()
female_prop# compute female and total counts by (decade, category)
female_counts = (
nobel[nobel['sex'] == 'Female']
.groupby(['decade', 'category'])['laureate_id']
.count()
)
total_counts = (
nobel
.groupby(['decade', 'category'])['laureate_id']
.count()
)
# compute the proportions and drop missing (if any)
female_prop_series = (female_counts / total_counts).dropna()
# inspect top entries to verify:
print("Top 10 proportions:\n", female_prop_series.sort_values(ascending=False).head(10))
# find the (decade, category) with highest proportion
max_idx = female_prop_series.idxmax() # returns tuple (decade, category)
max_category = max_idx[1]
max_decade = int(max_idx[0]) # ensure plain Python int
# build the requested dictionary {decade: category}
max_female_dict = {max_decade: max_category}
max_female_dict# Who was the first woman to receive a Nobel Prize, and in what category?
first_woman = nobel[nobel['sex'] == 'Female'].sort_values('year').iloc[0]
first_woman_name = first_woman['full_name']
first_woman_category = first_woman['category']
print(first_woman_name, first_woman_category)# Which individuals or organizations have won more than one Nobel Prize throughout the years?
repeat_winners = nobel.groupby('full_name').size()
repeat_list = repeat_winners[repeat_winners > 1].index.tolist()
print(repeat_list)