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
#finding the most commonly awarded gender
#nobel.columns
top_gender = nobel["sex"].value_counts().index[0]
top_gender
#finding the country with the most awards
top_country = nobel["birth_country"].value_counts().index[0]
top_country
import numpy as np
# Calculating the proportion of USA born winners
nobel["usa_born_winner"] = nobel["birth_country"] == 'United States of America'
nobel["decade"] = (np.floor(nobel["year"]/10) * 10).astype(int)
prop_usa_winners = nobel.groupby("decade")["usa_born_winner"].mean().reset_index()
prop_usa_winners
#Identify the decade with the highest proportion of US-born winners
max_decade_usa = prop_usa_winners[prop_usa_winners["usa_born_winner"] == prop_usa_winners ["usa_born_winner"].max()]["decade"].values[0]
print("The decade with the highest proportion of us-born winners:", max_decade_usa)
# plotting the usa-born winners
ax1 = sns.relplot(x='decade', y='usa_born_winner', data=prop_usa_winners, kind="line")
#calculating the proportion of female winners by decade and category
nobel["female_winners"] = nobel["sex"] == "Female"
prop_female_winners = nobel.groupby(["decade", "category"], as_index=False)["female_winners"].mean()
prop_female_winners
#finding the decade and category with the highest proportion of female winners
max_prop_female_winners = prop_female_winners[prop_female_winners["female_winners"] == prop_female_winners["female_winners"].max()][["decade", "category"]]
max_prop_female_winners
# Create a dictionary with the decade and category pair
max_female_dict = {max_prop_female_winners["decade"].values[0]: max_prop_female_winners["category"].values[0]}
max_female_dict
ax2 = sns.relplot(x='decade', y='female_winners', hue='category', data = prop_female_winners, kind="line")
nobel.head()
# Finding the first woman to win a Nobel Prize
nobel_women = nobel[nobel['female_winners']]
min_row = nobel_women[nobel_women['year'] == nobel_women['year'].min()]
#min_row
first_woman_name = min_row['full_name'].values[0]
first_woman_name
# Finding the category of the first woman to win a Nobel Prize
first_woman_category = min_row['category'].values[0]
first_woman_category
# Finding repeat winners
counts = nobel['full_name'].value_counts()
repeats = counts[counts >= 2].index
repeat_list = list(repeats)
repeat_list