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 dataset and view
nobel = pd.read_csv("data/nobel.csv")
nobel["decade"] = nobel['year'] // 10 * 10
nobel.head()#Store the quantity of Nobel prize won by gender
top_gender = nobel["sex"].value_counts(sort = True).index[0]
top_gender#Store the quantity of nobel prize winners per birth country
top_country = nobel["birth_country"].value_counts(sort = True).index[0]
top_country#Filter the nobel dataset to only United States winners
#Create a new column of the decade in which a nobel prize was won
#Count the total nobel prize won per decade
nobel_usa = nobel[nobel["birth_country"] == "United States of America"]
nobel_usa['decade'] = nobel["year"] // 10 * 10
max_decade_usa = nobel_usa["decade"].value_counts(sort = True, normalize = True).round(2).index[0]
max_decade_usa#Create a column with True or False, if it's female or not
#Group by the decade and category, as_index = False to run as table. Take the mean of the total female_winners by the group by columns
#Filter by extracting the max value in female_winners column and include the decade and category columns
#The max_female_dict is a dictionary with the max decade as key and the max category as value of the most females that won the nobel prize per decade and category
nobel["female_winners"] = nobel["sex"] == "Female"
prop_female_winners = nobel.groupby(by = ["decade","category"], as_index = False)["female_winners"].mean()
max_female_decade_category = prop_female_winners[prop_female_winners["female_winners"] == prop_female_winners["female_winners"].max()][["decade","category"]]
max_female_dict = {max_female_decade_category["decade"].values[0]:max_female_decade_category["category"].values[0]}#Create a new dataset that filters the first female to win a nobel prize
first_wm_yr = nobel_fem[nobel_fem["year"] == nobel_fem["year"].min()]
first_wm_yr
first_woman_name = first_wm_yr["full_name"].values[0]
first_woman_category = first_wm_yr["category"].values[0]#Count the total nobel prize winners by taking the full_name column.
#Filter the counts that have more than two counts. Take the counts by their index. Passed the index values to a list function and the list function is stored in the repeat_list variable
nobel_ind_mlt = nobel["full_name"].value_counts(sort = True)
repeat_list = list(nobel_ind_mlt[nobel_ind_mlt >= 2].index)
repeat_list