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
#Read in data from csv to a dataframe
data=pd.read_csv('data/nobel.csv')
#aggregate winners by 'sex' and count. Identify which 'sex' was awarded the most prizes
top_gender=data.value_counts('sex').idxmax()
#Aggregate winners by 'birth_country' and count. Identify which 'birth_country' was awarded the most prizes
top_country=data.value_counts('birth_country').idxmax()#Bin 'year' data by decade
start=data['year'].min()
end=data['year'].max()
x = range(1900, 2040, 10)
type(x)
z=[]
a=[]
for i in x:
z.append(i)
if i < x[-1]:
a.append(i)
data['prize_decade']=pd.cut(data['year'], bins=z, labels=a)
#Aggregate by 'prize_decade' and compute proportion of winners for each 'birth_country'.
bydecade = data.groupby(by=['prize_decade'])['birth_country'].value_counts(normalize=True)
#extract decade where the us had the highest proportion of winners
bydecade=bydecade.unstack(0)
max_decade_usa = bydecade.loc['United States of America'].idxmax().item()#Aggregate by 'prize_decade' and 'category' and compute proportion of winners for 'sex' == 'Female'
decadeCat = data.groupby(by=['prize_decade', 'category'])['sex'].value_counts(normalize=True)
decadeCat.head()
decadeCat = decadeCat.unstack([0,1])
max_female = decadeCat.loc['Female'].idxmax()
max_female_dict={max_female[0] : max_female[1]}#Extract name of first woman to win the prize and the prize category
female=data[data['sex']=='Female'][['year','full_name', 'category']].reset_index(drop=True)
female.head()
first_woman=female[female['year'] == female['year'].min()][['full_name', 'category']]
first_woman_name=first_woman['full_name'][0]
first_woman_category=first_woman['category'][0]
#Extract individual names with more than one prize
repeat_list=data['full_name'].value_counts()
repeat_list=repeat_list[repeat_list > 1].index.to_list()