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

# Reading nobel.csv into a DataFrame
nobel = pd.read_csv('data/nobel.csv', sep=',')

# Displaying the columns of the DataFrame
print(nobel.columns)

# Grouping by 'sex' and counting the occurrences
sex_counts = nobel['sex'].value_counts()
#print(sex_counts)

# Grouping by 'birth_country' and counting the occurrences
country_counts = nobel['birth_country'].value_counts()
#print(country_counts)

# Finding the top gender and country
top_gender = sex_counts.sort_values(ascending=False).index[0]
top_country = country_counts.sort_values(ascending=False).index[0]
#print(top_gender, top_country)

# Adding 'decade' column based on 'year'
bins = range(1900, 2031, 10)
labels = [f"{decade}" for decade in range(1900, 2030, 10)]
nobel['decade'] = pd.cut(nobel['year'], bins=bins, labels=labels, right=False)

# Filtering for USA born laureates and grouping by 'decade'
usa_born = nobel[nobel['birth_country'] == 'United States of America']
us_born_ratio = usa_born.groupby('decade').size() / nobel.groupby('decade').size()
max_decade_usa = int(us_born_ratio.idxmax())

# Filtering only female laureats
female_only = nobel[nobel['sex']=='Female']
# Calculating ratio of female laureats per category/decade pair
female_ratio = female_only.groupby(by=['decade','category']).size() / nobel.groupby(by=['decade','category']).size()
# Identifying specific category/decade pair with the highest female proportion
answer2 = female_ratio[female_ratio == female_ratio.max()]
max_female_dict = {int(answer2.index[0][0]): answer2.index[0][1]}

# Identifying first ever female laureat, her full_name and category
answer3 = female_only.sort_values('year', ascending=True).iloc[0]
first_woman_name,  first_woman_category = [answer3['full_name'], answer3['category']]

# Corrected line: Using the correct aggregation function
repeat_list = nobel['full_name'].value_counts()[nobel['full_name'].value_counts() >= 2].index.tolist()
repeat_list