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!

Load the dataset and find the most common gender and birth country

# Load the dataset
nobel_df = pd.read_csv('data/nobel.csv')

# Display the first few rows of the dataframe to understand its structure
nobel_df.head()
# Find the most common gender
top_gender = nobel_df['sex'].mode()[0]

# Find the most common birth country
top_country = nobel_df['birth_country'].mode()[0]

top_gender, top_country
#Create a flag for winners whose birth country is "United States of America"
nobel_df['is_USA'] = nobel_df['birth_country'] == 'United States of America'
# Create a decade column
nobel_df['decade'] = (nobel_df['year']//10)*10
nobel_df['decade'] = nobel_df['decade'].astype(int)
df_new = nobel_df.groupby('decade', as_index=False)['is_USA'].mean()
max_decade_usa = df_new[df_new['is_USA'] == df_new['is_USA'].max()]['decade'].values[0]
print(max_decade_usa)
sns.relplot(x='decade', y='is_USA', data=df_new, kind='line');
nobel_df['female_winner'] = nobel_df['sex'] == 'Female'
nobel_df_female = nobel_df.groupby(['decade', 'category'],as_index=False)['female_winner'].mean()
max_female_dict = {nobel_df_female[nobel_df_female['female_winner'] == nobel_df_female['female_winner'].max()]['decade'].values[0]: nobel_df_female[nobel_df_female['female_winner'] == nobel_df_female['female_winner'].max()]['category'].values[0]}
max_female_dict
sns.relplot(x='decade', y='female_winner', data=nobel_df_female, hue='category', kind='line');
new_df = nobel_df[nobel_df['female_winner']]
min_row = new_df[new_df['year'] == new_df['year'].min()]
first_woman_name, first_woman_category = min_row['full_name'].values[0], min_row['category'].values[0]
print(f"first woman name: {first_woman_name}")
print(f"first woman category: {first_woman_category}")
repeat_winners = pd.DataFrame(nobel_df['full_name'].value_counts())
repeat_list = list(repeat_winners[repeat_winners['full_name'] >= 2].index)
repeat_list