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 matplotlib.pyplot as plt
import numpy as np
# Load the dataset
nobel = pd.read_csv("data/nobel.csv")
print(nobel.head())
# dataset column
nobel.columns
# commonly awarded gender
top_gender = nobel.value_counts(nobel["sex"]).index[0]
print("The gender with the most Nobel laureates is :", top_gender)
# commonly awarded country
top_country = nobel.value_counts(nobel["birth_country"]).index[0]
print("The most common birth country of Nobel laureates is :", top_country)
# The decade that had the highest ratio of US-born Nobel price winners to total winners in all categories
nobel['USA'] = nobel['birth_country'] == 'United States of America'
nobel['decade'] = (np.floor(nobel['year'] // 10) * 10).astype(int)
prop_usa_winners = nobel.groupby('decade')['USA'].mean().reset_index()
max_decade_usa = prop_usa_winners.loc[prop_usa_winners['USA'].idxmax(), 'decade']
print(max_decade_usa)
sns.relplot(x = "decade", y = "USA", data= nobel, kind = "line")
# which decade and nobel price category combination had the highest proportion of female
nobel['True'] = nobel['sex'] == 'Female'
max_female_tuple = nobel.groupby(['decade', 'category'])['True'].mean().idxmax()
max_female_dict = {max_female_tuple[0]: max_female_tuple[1]}
print(max_female_dict)
# first woman to receeive price and category
nobel_women = nobel[nobel['True']]
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"The first woman to win a Nobel Prize was {first_woman_name}, in the category of {first_woman_category}.")
# Selecting the laureates that have received 2 or more prizes
counts = nobel['full_name'].value_counts()
repeats = counts[counts >= 2].index
repeat_list = list(repeats)
print("\n The repeat winners are :", repeat_list)
nobel.columns
#print(nobel["birth_country"])