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 the csv file
nobel= pd.read_csv('data/nobel.csv')
# inspect the data
print("Columns", nobel.columns)
print("Count of columns and rows", nobel.shape)
# top gender and top birth country
# top gender
top_gender_count = nobel['sex'].value_counts()
top_gender = nobel['sex'].mode().iloc[0]
print("Top Gender:", top_gender)
# top country
top_country_count = nobel['birth_country'].value_counts()
top_country = nobel['birth_country'].mode().iloc[0]
print("Top Country:", top_country)
# decade with the highest ratio of us-born nobel prize winners to total winners
# covert year to decade
nobel['decade'] = (nobel['year'] // 10) * 10
# winners from usa
nobel['true_usa'] = nobel['birth_country'] == "United States of America"
# group winners by decade
winners_per_decade = nobel.groupby('decade')['laureate_id'].count()
# group winners in usa by decade
usa_winners_per_decade = nobel.groupby('decade')['true_usa'].sum()
# ratio of usa born winners to total winners
ratio = usa_winners_per_decade / winners_per_decade
# decade with highest ratio of usa born winners to total winners
max_decade_usa = ratio.idxmax()
print("Highest USA winner ratio:", max_decade_usa)
# decade and category that had the highest proportion of female laureates
# group winners by decade and category using their full names
total_winners_by_category = nobel.groupby(['decade', 'category'])['full_name'].count()
# group total_winners_by_category by female winners
female_winners_per_category = nobel[nobel['sex'] == 'Female'].groupby(['decade', 'category'])['full_name'].count()
# proportion of female winners per category by total winners by category
proportion = (female_winners_per_category / total_winners_by_category).fillna(0)
# highest proportion of female winners per category by total winners by category
max_index = proportion.idxmax()
# storying as a dictionary
max_female_dict = {max_index[0]:max_index[1]}
print("Highest female winner ratio:", max_female_dict)
# first woman to recieve a nobel prize
# all female winners
female_winners = nobel[nobel['sex'] == "Female"]
# first female winner
first_female_year = female_winners[female_winners['year'] == female_winners['year'].min()]
# full name of the firt woman winner
first_woman_name = first_female_year.iloc[0]['full_name']
print("First woman winner:", first_woman_name)
#firt woman winner's category
first_woman_category = first_female_year.iloc[0]['category']
print("First woman category:", first_woman_category)
# individuals who won more than one nobel prize
# count all individuals with their full naames
count = nobel['full_name'].value_counts()
# individuals who won more that one prize
more_than_one = count[count >= 2 ]
# convert to list
repeat_list = more_than_one.index.tolist()
print("Repeat list:", repeat_list)