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!
import pandas as pd
nobel= pd.read_csv("data/nobel.csv")
nobel.head(50)
# Loading in required libraries
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
# Read the csv file
nobel= pd.read_csv("data/nobel.csv")
#[1] Find most common gender and birth_country
top_gender = nobel["sex"].value_counts().index[0]
top_country = nobel["birth_country"].value_counts().index[0]
print("\n The gender with the most Nobel laureates is :", top_gender)
print(" The most common birth country of Nobel laureates is :", top_country)
#[2] Highest proportion of US-born winners
# Create us-born column
nobel["US_born_winners"] = nobel["birth_country"]=="United States of America"
# Create decade column
nobel["decade"]=nobel["year"] // 10 * 10
# Find the highest proportion
prop_usa_winners = nobel.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(max_decade_usa)
sns.relplot(x="decade", y="US_born_winners", data=prop_usa_winners, kind="line")
plt.show()
#[3] The highest proportion of female laureates
# create female_winner column correctly
nobel["female_winner"] = nobel["sex"] == "Female"
# Calculating the proportion of female laureates per decade
prop_female_winners = nobel.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_winners[prop_female_winners['female_winner'] == prop_female_winners['female_winner'].max()][['decade', 'category']]
# Create a dictionary with the decade and category pair
max_female_dict = {max_female_decade_category['decade'].values[0]: max_female_decade_category['category'].values[0]}
print(max_female_dict)
sns.relplot(x="decade", y="female_winner", data=prop_female_winners, kind="line", hue="category")
plt.show()
#[4] Find first woman to win a Nobel Prize
first_woman = nobel[nobel["female_winner"] & (nobel["year"] == nobel[nobel["female_winner"]]["year"].min())]
first_woman_name = first_woman["full_name"].values[0]
first_woman_category= first_woman["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}.")
#[5] Determine repeat winners
count= nobel["full_name"].value_counts()
repeat= count[count>=2].index
repeat_list=(repeat)
print("\n The repeat winners are :", repeat_list)