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
import matplotlib.pyplot as plt
# Start coding here!
dt = pd.read_csv("data/nobel.csv")
# countplot to see the most gender
top_gender = dt["sex"].value_counts().index[0]
top_country = dt["birth_country"].value_counts().index[0]
# Which decade had the highest ratio of US-born Nobel Prize winners to total winners in all categories?
dt['usa_born_winner'] = dt["birth_country"] == "United States of America"
dt['decade'] = (np.floor(dt['year'] / 10) * 10).astype(int)
prop_usa_winners = dt.groupby('decade', as_index=False)['usa_born_winner'].mean()
max_decade_usa=prop_usa_winners[prop_usa_winners['usa_born_winner'] == prop_usa_winners['usa_born_winner'].max()]['decade'].values[0]
#print(max_decade_usa)
# Which decade and Nobel Prize category combination had the highest proportion of female laureates?
# category and decade
dt["female_winner"]=dt["sex"] =="Female"
hmm =dt.groupby(["category","decade"],as_index=False)["female_winner"].mean()
#max_female_decade_category = prop_female_winners[prop_female_winners['female_winner'] == prop_female_winners['female_winner'].max()][['decade', 'category']]
max_female_decade_category=hmm[hmm['female_winner']== hmm['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]}
#Who was the first woman to receive a Nobel Prize, and in what category? "prize"
#dt filtered by women
noble_women=dt[dt["female_winner"]]
#print(dt.info())
#print(noble_women)
noble_women_year=noble_women[noble_women["year"]==noble_women["year"].min()][["prize", "category", "year","full_name"]]
#print(noble_women_year)
first_woman_name=noble_women_year["full_name"].values[0]
first_woman_category=noble_women_year["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?
# Selecting the laureates that have received 2 or more prizes
counts = dt['full_name'].value_counts()
repeats = counts[counts >= 2].index
print(repeats)
repeat_list = list(repeats)