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!
nobel = pd.read_csv('data/nobel.csv')
nobel.head()
# Find the most commonly awarded gender and country
top_gender = nobel.value_counts('sex').index[0]
top_country = nobel.value_counts('birth_country').index[0]
# Create columns for us_born winners and decade of award
nobel['us_born'] = nobel['birth_country'] == top_country
nobel['decade'] = (np.floor(nobel['year']/10) * 10).astype('int')
# Find the decade with the highest proportion of us born winners
us_born_dec_prop = nobel.groupby('decade', as_index=False)['us_born'].mean()
max_decade_usa = us_born_dec_prop[us_born_dec_prop['us_born'] == us_born_dec_prop['us_born'].max()].iloc[0, 0]
# Plot a relational line plot of decade against us born winners
g = sns.relplot(data=nobel, x='decade', y='us_born', kind='line', height=6)
g.set(xlabel="Decade", ylabel="Porportion of USA born winners")
plt.show()
# Create a new column for boolean values for female winners
nobel['is_female'] = nobel["sex"] == 'Female'
# Group by decade and category and find the proportion of female winners
female_nobel = nobel.groupby(['decade', 'category'], as_index=False)['is_female'].mean()
# Find the decade and category with the highest proportion of female winners
max_female = female_nobel[female_nobel['is_female']==female_nobel['is_female'].max()][['decade', 'category']].set_index('decade')['category']
# Create a dictionary of the decade and category with the highest proportion of female winners
max_female_dict = max_female.to_dict()
# Plot a relational line plot of decade against us born winners
g = sns.relplot(data=female_nobel, x='decade', y='is_female', kind='line', hue='category', height=6)
g.set(xlabel="Decade", ylabel="Proportion of Female Winners")
plt.show()
# Subset for female winners only
female_winners = nobel[nobel['sex']=='Female']
# Subset for the name and category of the first woman to win
first_woman_name = female_winners.iloc[0]['full_name']
first_woman_category = female_winners.iloc[0]['category']
# Create a list of name of individuals with multiple award
repeat = nobel['full_name'].value_counts()
repeat = repeat[repeat>1]
repeat_names_list = list(nobel[nobel['full_name'].isin(repeat.index)]['full_name'].unique())
# Add the list to repeat_list
repeat_list = repeat_name_list