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

# Start coding here!
#importing data and checking if the Data is tidy and without null values 

df = pd.read_csv("data/nobel.csv")
df.head()
df.describe()
df.info()
#Finding the most commonly awarded gender and birth country 
top_gender = str(df.value_counts(df['sex']).index[0])
top_country = str(df.value_counts(df['birth_country']).index[0])

print(top_gender)
print(top_country)

#Identify the decade with the highest ratio of US-born winners

df['US_born_win'] = (df['birth_country'] == "United States of America")

#Creating new column for decades 
df['decade'] = (df['year'] // 10) * 10


#Finding the ratio
total_winners_per_decade = df.groupby('decade')['birth_country'].size()
us_winners_per_decade = df.groupby('decade')['US_born_win'].sum()
ratio_per_decade = us_winners_per_decade / total_winners_per_decade
max_decade_usa = ratio_per_decade.idxmax()
max_ratio_value = ratio_per_decade.max()

print(f"The decade with the highest ratio of US-born Nobel Prize winners to total winners is {max_decade_usa} with a ratio of {max_ratio_value:.2f}.")
#Decade and Nobel Prize category combination had the highest proportion of female laureates

#Filtering for female winners
total_laureates_per_decade = df.groupby(['decade', 'category']).size()
female_win = df[df['sex'] == 'Female']

#Grouping by two columns
total_female_laureates_per_decade = female_win.groupby('decade')['category'].size()

# Calculate proportion of female laureates
proportion_female_per_decade_category = total_female_laureates_per_decade / total_laureates_per_decade

#Find the decade and category with the highest proportion of female laureates
max_proportion_index = proportion_female_per_decade_category.idxmax()
max_decade_category = {'decade': max_proportion_index[0], 'category': max_proportion_index[1]}

print("Decade and Nobel Prize category combination with the highest proportion of female laureates:")
print(max_decade_category)

#Store the result as required
max_female_dict = {max_decade_category['decade']: max_decade_category['category']}
#Finding first woman to win a Nobel Prize

# We will filter by 'sex' and sort by 'year' to find the first female laureate

first_female_nobel = df[df['sex'] == 'Female'].sort_values(by='year').iloc[0]

# Extracting relevant information
first_woman_name = first_female_nobel['full_name']
first_woman_category = first_female_nobel['category']

first_woman_name, first_woman_category
#Individuals or organizations that have won more than one Nobel Prize throughout the years
repeat_winners = df['full_name'].value_counts()
repeat_list = repeat_winners[repeat_winners > 1].index.tolist()

repeat_list