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!
import os
current_dir = os.getcwd()
file_path = os.path.join(current_dir, 'data', 'nobel.csv')
nobel_winners = pd.read_csv(file_path)
#print(nobel_winners.info())
#print(nobel_winners.head())
#Most awarded gender
total_genders = nobel_winners['sex'].value_counts()
top_gender = total_genders.index.max()
#print(top_gender)
#Most awarded country
total_countries = nobel_winners['birth_country'].value_counts(sort=True)
top_country = total_countries.idxmax()
#Decade with the highest ratio of US-born to total winners
def assign_decade(year):
'''Returns the decade of a given year'''
decade = (year // 10) * 10
return decade
nobel_winners['decade'] = nobel_winners['year'].apply(assign_decade)
def flag_us(birth_country):
'''Returns True if birth country is United States of America'''
true = birth_country == 'United States of America'
return true
nobel_winners['US_born'] = nobel_winners['birth_country'].apply(flag_us)
decade = nobel_winners.groupby('decade')['US_born'].mean()
max_decade_usa = decade.idxmax()
#print(max_decade_usa)
#us = nobel_winners[nobel_winners['US_born'] == True]
#counts = us.groupby('decade')['US_born'].count()
#max_decade_usa = counts.index.max()
#print(max_decade_usa)
def flag_female(sex):
true = sex == 'Female'
return true
nobel_winners['female'] = nobel_winners['sex'].apply(flag_female)
#Decade with highest proportion of female laureates
gender = nobel_winners.groupby(['decade', 'category'])['female'].mean()
#print(gender)
index = gender.idxmax()
#print(index)
li_index = list(index)
max_female_dict = {index[0]:index[1]}
#print(max_female_dict)
#First woman to receive Nobel Prize
female = nobel_winners[nobel_winners['sex']=='Female']
female_cat = female['category'].head(1)
female_cat_li = list(female_cat)
first_woman_category = female_cat_li[0]
print(first_woman_category)
female_name = first_female['full_name'].head(1)
female_name_li = list(female_name)
first_woman_name = female_name_li[0]
print(first_woman_name)
#List of individuals who have won more than once
count_names = nobel_winners['full_name'].value_counts()
repeat = count_names[count_names > 1]
repeat_list = list(repeat.index)
#print(repeat_list)