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!1 - Load the dataset and find the most common gender and birth country
# Load in data
nobel = pd.read_csv('data/nobel.csv')
nobel.head()# Most common value in a column
top_gender = nobel['sex'].value_counts().index[0]
top_country = nobel['birth_country'].value_counts().index[0]
print('Top gender: {}'.format(top_gender))
print('Top country: {}'.format(top_country))2 - Identify the decade with the highest proportion of US-born winners
# Create the US-born winners column
nobel['usa_born_winner'] = nobel['birth_country'] == 'United States of America'
nobel.head()# Create the decade column
nobel['decade'] = (np.floor(nobel['year']/10)*10).astype('int')
nobel.head()# Finding the proportion
prop_usa_winners = nobel.groupby('decade', as_index=False)['usa_born_winner'].mean()
prop_usa_winners.head()# Identify the decade with the highest proportion of US-born winners
max_decade_usa = prop_usa_winners[prop_usa_winners['usa_born_winner'] == prop_usa_winners['usa_born_winner'].max()]['decade'].values[0]
print('Decade with highest proportion of US-born winners: {}'.format(max_decade_usa))# Create a relational plot
g = sns.relplot(x='decade', y='usa_born_winner', data=prop_usa_winners, kind='line')
g.fig.suptitle('US-Born Winners', y=1.03)
g.set(xlabel='Decade',
ylabel='Proportion of US-born winners');3 - Find the decade and category with the highest proportion of female laureates
# Filtering for female winners
nobel['female_winner'] = nobel['sex'] == 'Female'
nobel.head()# Group by two columns
prop_female_winners = nobel.groupby(['decade', 'category'], as_index=False)['female_winner'].mean()
prop_female_winners.head()# Find the decade and category with the highest female winners
max_female_decade_category = prop_female_winners[prop_female_winners['female_winner'] == prop_female_winners['female_winner'].max()][['decade', 'category']].values
max_female_dict = dict(max_female_decade_category)
print(max_female_dict)