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 dataset into Pandas
nobel = pd.read_csv('data/nobel.csv')



#Question 1

# count per gender
gender_count = nobel['sex'].value_counts()

#most commonly awarded gender
top_gender = gender_count.head(1).index[0]

print(top_gender)

#count per birth country
birth_country_count = nobel['birth_country'].value_counts()

#most commonly awarded birth country 
top_country = birth_country_count.head(1).index[0]

print(top_country)




#Question 2

#create decade column
nobel['decade'] = ((nobel['year']//10)*10).astype(int)

# Create USA winners column
nobel['USA_winner'] = nobel['birth_country'] == 'United States of America'

# Find ratio of USA winners to total prize winners
USA_to_total_prize = nobel.groupby('decade', as_index=False)['USA_winner'].mean()

# Sort USA_to_total_prize in descending order
USA_to_total_prize_sorted = USA_to_total_prize.sort_values('USA_winner', ascending=False)

max_decade_usa = USA_to_total_prize_sorted.iloc[0, 0]

print(max_decade_usa)

sns.set_style('whitegrid')
sns.set_context('notebook')
USA_winners = sns.relplot(x='decade', y= 'USA_winner', data=USA_to_total_prize,kind='line')
USA_winners.fig.suptitle('Proportion of nobel winners born in the USA in each decade', y=1.05)



#Question 3

#create column for female winners
nobel['female_winners'] = nobel['sex'] == 'Female'

#prop of female winners per decade-category combination
prop_female = nobel.groupby(['decade', 'category'], as_index=False)['female_winners'].mean()

#sort prop_female by decade-category comb
prop_female_sorted = prop_female.sort_values('female_winners', ascending=False)

#max female
max_female = prop_female_sorted.head(1).iloc[0,:]

#decade and Nobel Prize category combination with highest proportion of female laureates
max_female_dict = {max_female['decade']: max_female['category']}

print(max_female_dict)

sns.set_style('whitegrid')
sns.set_context('notebook')
prop_female_winners= sns.relplot(x='decade', y='female_winners', data=prop_female, kind='line', hue='category', style='category')
prop_female_winners.fig.suptitle('Proportion of female winners in each decade for each category', y=1.05)



#Question 4

#select category, full name and sex columns from nobel df
nobel_subset = nobel[['category','full_name', 'sex']]

#first nobel prize winner
first_woman = nobel_subset[nobel_subset['sex'] == 'Female'].head(1)

#first woman name
first_woman_name = first_woman.iloc[0,1]

#first woman category
first_woman_category = first_woman.iloc[0,0]

print(first_woman_name)
print(first_woman_category)



#Question 5

#Number of nobels per person
nobels_per_person = nobel['full_name'].value_counts()

#people with two or more nobels
two_or_more_nobels = nobels_per_person[nobels_per_person >= 2].index

#convert two_or_more_nobels to a list
repeat_list = list(two_or_more_nobels)

print(repeat_list)