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!
# Loading csv file

nobel = pd.read_csv("data/nobel.csv")
print(nobel.columns)

# Most commonly awarded gender and birth country
top_gender = nobel["sex"].value_counts().index[0]
print(top_gender)
top_country = nobel["birth_country"].value_counts().index[0]
print(top_country)

# Creating US winners and decade columns
nobel["us_winners"] = nobel["birth_country"] == "United States of America"
print(nobel)
nobel["decade"] = (np.floor(nobel["year"]/10) * 10).astype(int)
print(nobel)

# Finding the ratio
us_winner_ratio = nobel.groupby("decade", as_index=False)["us_winners"].mean()
max_decade_row = us_winner_ratio[us_winner_ratio["us_winners"] == us_winner_ratio["us_winners"].max()]
max_decade_usa = max_decade_row["decade"].values[0]
print(max_decade_usa)


# Max Decade USA Relational plot
sns.relplot(x="decade", y="us_winners", data=us_winner_ratio, kind="line")

# Filtering for female winners
nobel["female_winner"] = nobel["sex"] == "Female"
print(nobel)

# Groupby decade and finding mean for female winners
mean_female_winner = nobel.groupby(["decade", "category"], as_index=False)["female_winner"].mean()
# Finding the row with the highest mean
max_female_winner = mean_female_winner[mean_female_winner["female_winner"] == mean_female_winner["female_winner"].max()]
max_decade_category = max_female_winner[["decade", "category"]]
print(max_decade_category)

# Creating a dictionary for the decade and category with highest female laureates
max_female_dict = {max_decade_category["decade"].values[0]: max_decade_category["category"].values[0]}
print(max_female_dict)

# Max female dict relational plot
sns.relplot(x="decade", y="female_winner", data=mean_female_winner, kind="line", hue="category")

# Finding the first woman to win a Nobel Prize and the category
first_woman = nobel[nobel["female_winner"]].sort_values("year").iloc[0]
first_woman_name = first_woman["full_name"]
print(first_woman_name)
first_woman_category = first_woman["category"]
print(first_woman_category)

# Finding the individuals/organisations with more than one Nobel Prize
prize_winners = nobel["full_name"].value_counts()
more_than_one = prize_winners[prize_winners >= 2].index

# Converting to a list
repeat_list = list(more_than_one)