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 nobel as a dataframe
nobel = pd.read_csv('data/nobel.csv')
nobel
# Extracting the top gender and top 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)
# Idenfying the decate with the highest ratio to total winner in all categories
nobel["usa_born_winner"] = nobel["birth_country"] == 'United States of America'
nobel_year_wrapped = np.floor(nobel["year"]/10)
nobel_decade = (nobel_year_wrapped*10).astype(int)
nobel["decade"] = nobel_decade
nobel_decade_ratio = nobel.groupby("decade", as_index=False)["usa_born_winner"].mean()
#Identifying the decade with the highest ratio of US-born winners
max_decade_usa = nobel_decade_ratio[nobel_decade_ratio["usa_born_winner"] == nobel_decade_ratio["usa_born_winner"].max()]['decade'].values[0]
print(max_decade_usa)
# Determining the female winners
nobel["is_female"] = nobel["sex"] == "Female"
female_winners = nobel.groupby(['decade', 'category'], as_index=False)['is_female'].mean()
max_female_winners = female_winners[female_winners['is_female'] == female_winners['is_female'].max()]
decade_with_highest_female_winners = max_female_winners['decade'].values[0]
category_with_highest_female_winners = max_female_winners['category'].values[0]
max_female_dict = {decade_with_highest_female_winners: category_with_highest_female_winners}
# Finding the first woman to win a Nobel Prize
female_winner_df = nobel[nobel['is_female']]
min_row = female_winner_df[female_winner_df['year'] == female_winner_df['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}.")
# Determining the repeat winners
winner_counts = nobel['full_name'].value_counts()
winner_counts_2 = winner_counts[winner_counts >= 2].index
repeat_list = list(winner_counts_2)