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!

nobel_df = pd.read_csv('data/nobel.csv')
nobel_df.head(10)
# What is the most commonly awarded gender and birth country?
top_gender = nobel_df.groupby('sex')['sex'].count().idxmax()


top_country = nobel_df.groupby('birth_country')['sex'].count().idxmax()

print( top_gender, ", ", top_country)
# Which decade had the highest ratio of US-born Nobel Prize winners to total winners in all categories?
nobel_df_decades = nobel_df.copy()

## Create the decade grouping
nobel_df_decades['decade'] = (nobel_df_decades['year'] // 10) * 10

## Using the decade, find the numbers of US-born winners and total winners
us_born_winners_by_decade = nobel_df_decades[nobel_df_decades['birth_country'] == 'United States of America'].groupby('decade').size().reset_index(name='us_born_winners')

total_winners_by_decade = nobel_df_decades.groupby('decade').size().reset_index(name='total_winners')

## Calculate the ratio per decade
us_winner_ratio_df = us_born_winners_by_decade.merge(total_winners_by_decade, on='decade')
us_winner_ratio_df['ratio'] = us_winner_ratio_df['us_born_winners'] / us_winner_ratio_df['total_winners']

## Identify the decade witht the highest US winner ratio 
max_decade_usa = int(us_winner_ratio_df.sort_values('ratio', ascending = False).head(1)['decade'])
max_decade_usa
# Which decade and Nobel Prize category combination had the highest proportion of female laureates?

# Create a new DataFrame to store the ratio
nobel_df_female_split = nobel_df_decades[nobel_df_decades['sex'] == 'Female'].groupby(['category', 'decade']).size() / nobel_df_decades.groupby(['category', 'decade']).size()

nobel_df_female_split = nobel_df_female_split.reset_index(name='ratio')

# Sort dataframe by ratio and extract top value as a dictionary
nobel_df_female_split = nobel_df_female_split.sort_values('ratio', ascending=False)

# Extract the top row values
top_decade = nobel_df_female_split.iloc[0]['decade']
top_category = nobel_df_female_split.iloc[0]['category']


## Create dictionary & print these details to verify
max_female_dict = {top_decade: top_category}
max_female_dict
# Who was the first woman to receive a Nobel Prize, and in what category?


## Identify the first ever woman laureate record
first_woman_laureate = nobel_df[nobel_df['sex'] == 'Female'].sort_values('year').iloc[0]

## Extract the name and category from this record
first_woman_name = first_woman_laureate['full_name']
first_woman_category = first_woman_laureate['category']

## Print these details to verify
print(first_woman_name, ', ', first_woman_category)
# Which individuals or organizations have won more than one Nobel Prize throughout the years?

## Count total wins per laureate_id
multiple_nobel_wins = nobel_df.groupby(['laureate_id','full_name'])['year'].count().sort_values(ascending=False).reset_index(name = 'win_count')

## Isolate multiple winners
multiple_nobel_wins = multiple_nobel_wins[multiple_nobel_wins['win_count'] > 1]

## Convert the list of names into a list object
repeat_list = list(multiple_nobel_wins['full_name'])

## Validate Output
repeat_list