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
import matplotlib.pyplot as plt
df = pd.read_csv("data/nobel.csv")
top_gender = df.value_counts("sex").idxmax() # getting the top gender count
type(top_gender)
top_gender
plt.figure(figsize=(10,6))
sns.countplot(data=df, x='sex', order=df['sex'].value_counts().index)
plt.title('Gender with more number of Nobel Laureates')
plt.xlabel('sex')
plt.ylabel('Count')
plt.show()
top_country = df.value_counts("birth_country").idxmax() # getting the count for the top country
type(top_country)
top_country
#Most common birth (country top 10)
top_10_countries = df['birth_country'].value_counts().nlargest(10)
plt.figure(figsize=(10,6))
sns.barplot(x=top_10_countries.values, y=top_10_countries.index)
plt.title('Top 10 Birth Countries of Nobel Laureates')
plt.xlabel('Count')
plt.ylabel('Birth Country')
plt.show()
#getting a column for storing the decade
df['decade'] = ((df['year'] // 10) * 10)
df['US_born'] = df['birth_country'] == 'United States of America'
total_recipients_per_decade = df.groupby('decade').sum()
total_recipients_per_decade_US = df.groupby('decade')['US_born'].sum()
total_recipients_per_decade = total_recipients_per_decade.iloc[:, 0]
ratio_recipients = total_recipients_per_decade_US/total_recipients_per_decade
plt.figure(figsize=(10,6))
sns.lineplot(x=ratio_recipients.index, y=ratio_recipients.values)
plt.title('Ratio of US-born Nobel Laureates per Decade')
plt.xlabel('Decade')
plt.ylabel('total_recipients_per_decade_US / total_recipients_per_decade')
plt.xticks(rotation=45)
plt.grid(True)
plt.show()
#Which decade had the highest ratio of US-born Nobel Prize winners to total winners in all categories?
max_decade_usa = ratio_recipients.idxmax()
#Which decade and Nobel Prize category combination had the highest proportion of female laureates?
total_counts = df.groupby(['decade', 'category']).size()
female_counts = df[df['sex'] == 'Female'].groupby(['decade', 'category']).size()
female_ratios = female_counts / total_counts
combo = female_ratios.idxmax()
max_female_dict = {combo[0]: combo[1]}
#Plotting the data
top_female_ratios = female_ratios.sort_values(ascending=False).head(10).reset_index()
top_female_ratios.columns = ['Decade', 'Category', 'Proportion']
plt.figure(figsize=(12,6))
sns.barplot(data=top_female_ratios, x='Proportion', y='Category', hue='Decade', dodge=False)
plt.title('Top 10 (Decade, Category) Combinations by Proportion of Female Laureates')
plt.xlabel('Proportion Female')
plt.ylabel('Category')
plt.legend(title='Decade')
plt.show()
#Who was the first woman to receive a Nobel Prize, and in what category?
filtered_df = df[df['sex'] == 'Female']
filtered_df.head()
min_year = filtered_df['year'].min()
earliest_female = filtered_df[filtered_df['year'] == min_year]
first_woman_name = earliest_female.iloc[0]['full_name']
first_woman_category = earliest_female.iloc[0]['category']
#Which individuals or organizations have won more than one Nobel Prize throughout the years?
name_counts = df.value_counts('full_name')
repeat_names = name_counts[name_counts > 1].index
repeat_list = repeat_names.tolist()
repeat_df = df[df['full_name'].isin(repeat_list)]
plt.figure(figsize=(10,6))
sns.countplot(data=repeat_df, y='full_name', order=repeat_df['full_name'].value_counts().index)
plt.title('Individuals/Organizations with Multiple Nobel Prizes')
plt.xlabel('Number of Prizes')
plt.ylabel('Name')
plt.show()