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_df = pd.read_csv("data/nobel.csv")
print(nobel_df.head())
nobel_df.info()
# Most commonly awarded gender
top_gender = nobel_df["sex"].value_counts().index[0]
print("Top Gender is: ", top_gender)
type(top_gender)
# Most commonly awarded birth country
top_country = nobel_df["birth_country"].value_counts().index[0]
print("Top Country is: ", top_country)
type(top_country)
# What is the highest proportion of US born winners?
nobel_df["decade"] = (np.floor(nobel_df["year"]/10) * 10).astype(int)
nobel_df["us_born_winners"] = nobel_df["birth_country"] == "United States of America"
# np.floor rounds down to the nearest whole number and returns a float astype(int) converts float to an integer
prop_usa_winners = nobel_df.groupby('decade',as_index=False)['us_born_winners'].mean()
max_decade_usa = prop_usa_winners[prop_usa_winners['us_born_winners'] == prop_usa_winners['us_born_winners'].max()]['decade'].values[0]
print(f"{max_decade_usa} is the decade with the highest ratio of US-born Nobel Prize winners.")
# Plotting the US born winners
ax1 = sns.relplot(x="decade", y= "us_born_winners", data=nobel_df, kind = 'line')
ax1.ax.set_xlabel("Decade")
ax1.ax.set_ylabel("Proportion of US-Born winners")
ax1.fig.suptitle("Proportion of US-Born Nobel Prize Winners by Decade", fontsize = 14)
ax1.fig.subplots_adjust(top=0.9)
# Which decade and Nobel Prize category combination had the highest proportion of female laureates?
# Calculating the proportion of female laureates.
nobel_df["female_winner"] = nobel_df["sex"] == "Female"
prop_female_winner = nobel_df.groupby(['decade', 'category'], as_index = False)['female_winner'].mean()
# Find the decade and category with the highest proportion of female laureates.
max_female_decade_category = prop_female_winner[prop_female_winner['female_winner'] == prop_female_winner["female_winner"].max()][['decade','category']]
max_female_dict = {max_female_decade_category["decade"].values[0]:max_female_decade_category["category"].values[0]}
print(max_female_dict)
# Plotting female winners with % winners on the y-axis
ax2 = sns.relplot(x='decade', y='female_winner', data = prop_female_winner, hue= 'category', kind = 'line')
ax2.ax.set_xlabel("Decade")
ax2.ax.set_ylabel("% Female Winner")
ax2.fig.suptitle("Proportion of female winners", fontsize = 14)
ax2.fig.subplots_adjust(top = 0.9)
# Who was the first woman to receive a Nobel Prize, and in what category?
nobel_women = nobel_df[nobel_df["female_winner"]]
min_row = nobel_women[nobel_women["year"] == nobel_women["year"].min()]
first_woman_name = min_row["full_name"].values[0]
first_woman_category = min_row["category"].values[0]
print(f"\n The first woman to win a Nobel Prize was {first_woman_name}, in the category of {first_woman_category}.")
# Which individuals or organizations have won more than one Nobel Prize throughout the years?
counts = nobel_df["full_name"].value_counts()
repeats = counts[counts > 1].index
repeat_list = list(repeats)
print(f"The following individuals or organizations have won more than one Nobel Prize: {repeat_list}")