Skip to content

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')

# Preview of dataframe
nobel.head()

# Top gender
top_gender = nobel["sex"].value_counts().idxmax()
print(top_gender)

# Top country
top_country = nobel["birth_country"].value_counts().idxmax()
print(top_country)

# Which decade had the highest ratio of US-born Nobel Prize winners to total winners in all categories?

# Create a column indicating whether the winner was born in the United States
nobel['us_born'] = nobel['birth_country'] == 'United States of America'

# Convert 'year' column to numeric type
nobel['year'] = pd.to_numeric(nobel['year'], errors='coerce')

# Create a column to represent the decade of the Nobel Prize
nobel['decade'] = (nobel['year'] // 10) * 10

# Group the data by decade and calculate the ratio of US-born winners to total winners for each decade
decade_ratios = nobel.groupby('decade')['us_born'].mean()

# Identify the decade with the highest ratio of US-born winners
max_decade_usa = decade_ratios.idxmax()

# Plot the trend of the ratio over decades
decade_ratios.plot(kind='line', marker='o', figsize=(10, 6))
plt.title('Ratio of US-Born Nobel Prize Winners to Total Winners by Decade')
plt.xlabel('Decade')
plt.ylabel('Ratio')
plt.grid(True)
plt.xticks(decade_ratios.index)
plt.show()

print("Decade with the highest ratio of US-born Nobel Prize winners to total winners:", max_decade_usa)

# Which decade and Nobel Prize category combination had the highest proportion of female laureates?
female_laureates_per_decade = nobel[nobel['sex'] == 'Female'].groupby(['decade', 'category']).size()
total_laureates_per_decade = nobel.groupby(['decade', 'category']).size()
female_ratio_per_decade = female_laureates_per_decade / total_laureates_per_decade
max_female_dict = {female_ratio_per_decade.idxmax()[0]: female_ratio_per_decade.idxmax()[1]}

# Who was the first woman to receive a Nobel Prize, and in what category?
first_woman = nobel[nobel['sex'] == 'Female'].sort_values('year').iloc[0]
first_woman_name = first_woman['full_name']
first_woman_category = first_woman['category']

# Which individuals or organizations have won more than one Nobel Prize throughout the years?
repeat_list = nobel['full_name'].value_counts()[nobel['full_name'].value_counts() > 1].index.tolist()

print("Most commonly awarded gender:", top_gender)
print("Most commonly awarded birth country:", top_country)
print("Decade with the highest ratio of US-born Nobel Prize winners:", max_decade_usa)
print("Decade and Nobel Prize category with the highest proportion of female laureates:", max_female_dict)
print("First woman to receive a Nobel Prize:", first_woman_name, "in category:", first_woman_category)
print("Individuals or organizations that have won more than one Nobel Prize:", repeat_list)