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 matplotlib.pyplot as plt
import numpy as np

# Start coding here!
# Reading the csv file
df = pd.read_csv('data/nobel.csv')
df
# Most common gender
top_gender = df['sex'].value_counts().index[0]
print(f" The most commonly Nobel prize awarded gender : {top_gender}")
# Most common country
top_country = df['birth_country'].value_counts().index[0]
print(f" The most commonly Nobel prize awarded country is : {top_country}")
# USA born winners highest ratio
df['USA_winners'] = df['birth_country'] == 'United States of America'
df['decade'] = (np.floor(df['year']/10) * 10).astype(int)
prop = df.groupby('decade', as_index=False)['USA_winners'].mean()
# decade with max ratio
max_decade_usa = prop[prop['USA_winners'] == prop['USA_winners'].max()]['decade'].values[0]
max_decade_usa
g = sns.relplot(x='decade', y='USA_winners', data=prop, kind='line')
df['female_winners'] = df['sex']=='Female'
df_female = df.groupby(['decade', 'category'], as_index=False)['female_winners'].mean()
df_female

df_female_max = df_female[df_female['female_winners'] == df_female['female_winners'].max()][['decade', 'category']]
max_female_dict = {df_female_max['decade'].values[0] : df_female_max['category'].values[0]}
g = sns.relplot(x='decade',
            y='female_winners',
              data=df_female,
                kind='line',
                  hue='category')
df_female
df_women = df[df['female_winners']]
earliest = df_women[df_women['year']==df_women['year'].min()]
first_woman_name = earliest['full_name'].values[0]
first_woman_category = earliest['category'].values[0]
print(f"\n The first woman to win a Nobel Prize was {first_woman_name}, in the category of {first_woman_category}.")
# Selecting the laureates that have received 2 or more prizes
counts = df['full_name'].value_counts()
repeats = counts[counts >= 2].index
repeat_list = list(repeats)

print("\n The repeat winners are :", repeat_list)