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!
df = pd.read_csv('data/nobel.csv')
df.info()
df.head()
# Finding the most commonly awarded gender and birth country
# Prints the gender with the maximum number of entries
top_gender = df['sex'].value_counts().idxmax()
# Prints the birth country with the maximum number of entries
top_country = df['birth_country'].value_counts().idxmax()
print(top_gender)
print(top_country)
# Finding the decade with the highest ratio of US-born Nobel Prize winners to total winners in all categories
# Creating a US-born column that indicates if the winner is US-born
#df['US-born'] = df['birth_country'] == 'United States of America'
# Creating a decade column that indicates in which decade it was awarded
df['decade'] = (df['year']//10)*10
df['decade'] = df['decade'].astype(int)
# Calculating the ratio of US-born winners per decade
#ratio = df.groupby('decade')['US-born'].value_counts(normalize = True).to_dict()
#df['ratio'] = df.apply(lambda x: ratio.get((x['decade'], x['US-born'])), axis = 1)
# Subsetting
#df_US_born = df.loc[df['US-born'] == True, ['decade', 'ratio']]
# Finding the decade with the highest ratio of US-born Nobel Prize winners to total winners
#max_decade_usa = df_US_born.drop_duplicates(subset = 'decade').set_index('decade').idxmax().item()
#print(max_decade_usa)
#sns.lineplot(x = 'decade', y = 'ratio', data = df_US_born)
#plt.show()
US_born = df[df['birth_country'] == 'United States of America']
# Ratio
US_winners = US_born.groupby('decade').size()
winners_per_dec = df.groupby('decade').size()
ratio = US_winners/winners_per_dec.fillna(0)
# Max
max_decade_usa = ratio.idxmax()
print(max_decade_usa)
g = sns.lineplot(ratio)
g.set(ylabel = 'Ratio')
plt.show()
# Finding the decade and Nobel Prize category combination that had the highest proportion of female laureates
# Subsetting female laureates
df_female = df[df['sex'] == 'Female']
# Calculating proportion per decade and category
female = df_female.groupby(['decade', 'category']).size()
laureates = df.groupby(['decade', 'category']).size()
female_proportion = female/laureates.fillna(0)
# The highest proportion
max_female = female_proportion.idxmax()
max_female_dict = {max_female[0]:max_female[1]}
max_female_dict
# Finding the first woman to receive a Nobel Prize and her category
# Subsetting
female_winners = df.loc[df['sex'] == 'Female', ['full_name', 'category', 'year']]
first_woman_name = female_winners.loc[female_winners['year'].idxmin(),'full_name']
first_woman_category = female_winners.loc[female_winners['year'].idxmin(),'category']
print(first_woman_name)
print(first_woman_category)
# Individuals or organizations who have won more than one Nobel Prize throughout the years
repeats = df.groupby('full_name').agg(count = ('full_name', 'count'))
repeats = repeats[repeats['count'] > 1]
repeat_list = list(repeats.index)
print(repeat_list)