Vsualizing the History of Nobel Prize Winners
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!
1. Importing Libraries and reading data into a DataFrame
# Loading in required libraries
import pandas as pd
import seaborn as sns
import numpy as np
# Loading data into DataFrame
nobel = pd.read_csv(r'data/nobel.csv')
nobel.head(10)
2. Finding the most common gender and birth country
# What is the most commonly awarded gender and birth country?
top_gender = nobel.value_counts(subset='sex').index[0]
top_country = nobel.value_counts(subset='birth_country').index[0]
top_country
3. Indentifying the decade with the highest proportion of US-born winners
# Filtering data with US-born Nobel winners
nobel['US-born winner'] = nobel['birth_country'] == 'United States of America'
# Add 'decade' column
nobel['decade'] = np.floor(nobel['year'] / 10)
nobel['decade'] = nobel['decade'] * 10
nobel['decade'] = nobel['decade'].astype('int64')
# Find proportion of US-born Nobel Winners
df_US_proportion = nobel.groupby('decade', as_index=False).agg({'US-born winner':'mean'})
max_decade_usa = df_US_proportion[df_US_proportion['US-born winner'] == df_US_proportion['US-born winner'].max()]['decade'].values[0]
max_decade_usa
4. Finding the decade and category with the highest proportion of female laureates
# Filtering female winners
nobel['female_winner'] = nobel['sex'] == 'Female'
# Grouping by two columns
max_female = nobel.groupby(['decade','category'], as_index=False).agg({'female_winner':'mean'})
# Finding the decade and category with the highest female winners
highest_female_winner = max_female[max_female['female_winner'] == max_female['female_winner'].max()][['decade', 'category']]
highest_female_winner
# Creating a dictionary
max_female_dict = {highest_female_winner['decade'].values[0]: highest_female_winner['category'].values[0]}
max_female_dict
# Plotting female winners with % winners on the y-axis (optional)
plot2 = sns.relplot(data=max_female, x='decade', y='female_winner', hue='category', kind='line')
5. Finding first woman to win a Nobel Prize
# Fitering only the Nobel female winners to a DataFrame
df_woman = nobel[nobel['female_winner'] == True]
# Filtering the first Nobel female winner
df_first_woman = df_woman[df_woman['year'] == df_woman['year'].min()]
# Filtering the name of the first Nobel female winner
first_woman_name = df_first_woman['full_name'].values[0]
# Filtering the researching field of the first Nobel female winner
first_woman_category = df_first_woman['category'].values[0]