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')
top_gender = nobel.sex.value_counts().index[0]
top_country = nobel.birth_country.value_counts().index[0]
nobel['decade'] = (np.floor(nobel['year'] / 10) * 10).astype(int)
nobel['us_born_winners'] = nobel['birth_country'] == top_country
proportion_usa = nobel.groupby('decade')['us_born_winners'].mean()
max_decade_usa = proportion_usa.idxmax()
# df['us_born_winners'].value_counts()
# proportion_usa = df.groupby('decade', as_index=False)['us_born_winners'].mean()
# print(f'Proportion USA {proportion_usa}')
# max_decade_usa = proportion_usa.loc[proportion_usa['birth_country'].idxmax(), 'decade']
# max_decade_usa = proportion_usa.decade.max()
# high_prop_usa = proportion_usa['us_born_winners'].max()
# print(f'High prop USA {high_prop_usa}')
# max_decade_usa = proportion_usa[proportion_usa['us_born_winners']==high_prop_usa]
sns.relplot(x='decade', y='us_born_winners', data=nobel, kind='line')
plt.show()
nobel['female_winner'] = nobel['sex'] == 'Female'
female_proportion = nobel.groupby(['decade', 'category'])['female_winner'].mean()
# high_f_prop = female_proportion.max()
max_female_winners = female_proportion.idxmax()
# max_female_winners = female_proportion[female_proportion == high_f_prop]
# female_proportion = female_proportion[female_proportion['female_winner']==high_f_prop]
# print(type(max_female_winners))
max_female_dict = {max_female_winners[0]: max_female_winners[1]}
sns.relplot(x='decade', y='female_winner', data=nobel, kind='line', hue='category')
plt.show()
# first_woman = nobel_data[nobel_data['gender'] == 'Female'].sort_values('year').iloc[0]
first_woman = nobel[nobel['female_winner'] == True].sort_values('year').iloc[0]
first_woman_name, first_woman_category = first_woman[['full_name', 'category']]
winners = nobel['full_name'].value_counts()
repeat_list = winners[winners > 1].index
print("Most commonly awarded gender:", top_gender)
print("Most commonly awarded birth country:", top_country)
print("Decade with the highest proportion of US-born winners:", max_decade_usa)
print("Decade and category with the highest proportion of female winners:", max_female_winners)
print("First woman to receive a Nobel Prize:", first_woman_name, "in category:", first_woman_category)
print("Individuals or organizations who have won multiple Nobel Prizes:", repeat_list)