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
pd.set_option('display.max_columns', None)
# Start coding here!
# Load the data
nobel = pd.read_csv('data/nobel.csv')
# Check the first few rows of the DataFrame nobel
display(nobel.head())
# Check the size of the dataset
nobel.shape
# Get more information about the columns
nobel.info()
# What is the most commonly awarded gender and birth country?
top_gender = nobel['sex'].value_counts().index[0]
top_country = nobel['birth_country'].value_counts().index[0]
print(f"The most commonly awarded gender is {top_gender} and birth country is {top_country}.")
# What decade had the highest proportion of US-born winners?
# Create a column that creates a flag for winners whose birth country is USA
nobel['usa_born_winner'] = np.where(nobel['birth_country'] == 'United States of America', 1,0)
# Create a decade column
nobel['decade'] = (np.floor(nobel['year'] / 10) * 10).astype(int)
# Take a look at the new columns
nobel[['usa_born_winner', 'decade']].sample(5)
# Calculate the proportion of usa born winners
us_prop = nobel.groupby('decade', as_index=False)['usa_born_winner'].mean()
max_decade_usa = us_prop.sort_values('usa_born_winner', ascending = False)['decade'].values[0]
#max_decade_usa = us_prop[us_prop['usa_born_winner'] == us_prop['usa_born_winner'].max()]['decade'].values[0]
print(f"The highest proportion of US-born winners was in {max_decade_usa}.")
# Plotting USA born winners
ax1 = sns.relplot(x='decade', y='usa_born_winner', data=us_prop, kind="line")
# What decade and category pair had the highest proportion of female laureates?
# Create a column that creates a flag for female winners
nobel['female_winner'] = np.where(nobel['sex'] == 'Female', 1,0)
# Calculate the proportion of female winners
female_prop = nobel.groupby(['decade', 'category'], as_index=False)['female_winner'].mean()
female_prop = female_prop.sort_values('female_winner', ascending=False).reset_index()
max_female_dict = {female_prop['decade'][0] :female_prop['category'][0]}
print(f"The decade and category pair with the highest proportion of female laureates is {max_female_dict}.")
# Who was the first woman to receive a Nobel Prize, and in what category?
first_woman_winner = nobel[nobel['sex'] == 'Female'].nsmallest(1, 'year')[['full_name','year', 'category']]
first_woman_name = first_woman_winner['full_name'].values[0]
first_woman_category = first_woman_winner['category'].values[0]
print(f"The first woman to receive a Nobel Prize was {first_woman_name} in the category {first_woman_category}.")
# Which individuals or organizations have won multiple Nobel Prizes throughout the years
# Get the value counts of winners
winners = nobel['full_name'].value_counts()
# Select winners with 2 or more prizes
repeat_winners = winners[winners >= 2].index
repeat_list = list(repeat_winners)
print(f"These are the individuals or organizations that have won multiple prizes {repeat_list}.")