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
# Start coding here!
nobel = pd.read_csv('data/nobel.csv')
nobel.head()
top_gender = nobel['sex'].mode()[0]
top_country = nobel['birth_country'].mode()[0]
print(f'the most commonly awarded gender is {top_gender}')
print(f'the most commonly awarded birth country is {top_country}')
nobel['usa_born'] = nobel['birth_country'] == 'United States of America'
nobel['decade'] = nobel['year'].apply(lambda year: np.floor(year/10) * 10)
nobel['decade'] = nobel['decade'].astype(int)
nobel_usa = nobel.groupby('decade', as_index=False)['usa_born'].mean()
max_decade_usa = nobel_usa[nobel_usa['usa_born'] == nobel_usa['usa_born'].max()]['decade'].values[0]
print(f'{max_decade_usa} decade had the highest ratio of US-born Nobel Prize winners.')
sns.relplot(x='decade', y='usa_born', data=nobel_usa, kind="line")
nobel['female_winner'] = nobel['sex'] == 'Female'
female_winners = nobel.groupby(['decade', 'category'], as_index=False)['female_winner'].mean()
max_female_decade_category = female_winners[female_winners['female_winner'] == female_winners['female_winner'].max()][['decade', 'category']]
max_female_dict = dict(max_female_decade_category.values)
womens = nobel[nobel['female_winner']]
first_woman = womens[womens['year'] == womens['year'].min()]
first_woman_name = first_woman['full_name'].values[0]
first_woman_category = first_woman['category'].values[0]
print(f"\n The first woman to win a Nobel Prize was {first_woman_name}, in {first_woman_category} category.")
nobel_counts = nobel['full_name'].value_counts()
more_than_one = nobel_counts[nobel_counts > 1]
repeat_list = list(more_than_one.index)
print(repeat_list)