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!
#What is the most commonly awarded gender and birth country?
data = pd.read_csv("data/nobel.csv")
data.head()
#What is the most commonly awarded gender and birth country?
top_gender = data['sex'].value_counts().idxmax()
print('Top Gender is:',top_gender)
top_country = data['birth_country'].value_counts().idxmax()
print('Top Country is:', top_country)
#Which decade had the highest ratio of US-born Nobel Prize winners to total winners in all categories?
data.head()
max_decade = data.groupby('birth_country')['year'].value_counts().idxmax()
max_decade_usa = (data['year'] // 10 * 10).value_counts().idxmax()
print(max_decade_usa)
#Which decade and Nobel Prize category combination had the highest proportion of female laureates?
# Convert year to decade
data['decade'] = (data['year'] // 10) * 10
# Count total winners by decade and category
total_counts = data.groupby(['decade', 'category']).size()
# Count female winners by decade and category
female_counts = data[data['sex'] == 'Female'].groupby(['decade', 'category']).size()
# Calculate the proportion of female winners
female_proportion = (female_counts / total_counts).fillna(0)
# Find the decade-category pair with the highest proportion
max_female_combination = female_proportion.idxmax() # (decade, category)
# Store as a dictionary with one key-value pair
max_female_dict = {max_female_combination[0]: max_female_combination[1]}
print(max_female_dict)
#Who was the first woman to receive a Nobel Prize, and in what category?
first_woman_name = data[data['sex'] == 'Female'].sort_values('year').iloc[0]['full_name']
print(first_woman_name)
first_woman_category = data[data['sex'] == 'Female'].sort_values('year').iloc[0]['category']
print(first_woman_category)
# Count how many times each name appears
repeat_winners = data['full_name'].value_counts()
# Filter for names that appear at least twice (meaning they won more than once)
repeat_list = list(repeat_winners[repeat_winners >= 2].index)
print(repeat_list)
#repeat_names = data['name'].value_counts()
#multiple_winners = data[data['name'].isin(repeat_names[repeat_names > 1].index)][['name', 'category', 'year']]
#print(multiple_winners.sort_values(['name', 'year']))