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 warnings
warnings.filterwarnings('ignore')
# Start coding here!
#load data and dataset overview
nobel = pd.read_csv('data/nobel.csv')
nobel.head(5)
nobel.tail(5)
nobel.dtypes
nobel.info()
#descriptive analysis
nobel.describe()#most commonly awarded gender and birth country
top_gender = nobel['sex'].value_counts().index[0]
top_country = nobel['birth_country'].value_counts().index[0]
print(f'Most Common Gender:{top_gender}')
print(f'Most Common Birth Country:{top_country}')import pandas as pd
import numpy as np
# Assuming 'nobel' DataFrame is already defined and loaded with data
# Example: nobel = pd.read_csv('path_to_nobel_data.csv')
# Decade with the highest ratio of US born Nobel winners
nobel['us_winners'] = nobel['birth_country'] == 'United States of America'
nobel['decade'] = (np.floor(nobel['year'] / 10) * 10).astype(int)
prop_us_winners = nobel.groupby('decade', as_index=False)['us_winners'].mean()
max_decade_usa = prop_us_winners[prop_us_winners['us_winners'] == prop_us_winners['us_winners'].max()]['decade'].values[0]
print(max_decade_usa)#visualizing the US born winners
ax1 = sns.relplot(x='decade', y='us_winners',data = prop_us_winners, kind = 'line' )#decade and nobel prize category with highest proportion of female laureates
nobel['female_laureates'] = nobel['sex'] == 'Female'
df_female = nobel.groupby(['decade','category'], as_index=False)['female_laureates'].mean()
max_female_dict = {df_female[df_female['female_laureates']==df_female['female_laureates'].max()]['decade'].values[0]:df_female[df_female['female_laureates']==df_female['female_laureates'].max()]['category'].values[0]}
print(max_female_dict)
#visualize the relationfemale winner
ax2=sns.relplot(x='decade', y='female_laureates', data=df_female, hue='category', kind='line')#first woman to recieve nobel prize and in what category
first_woman= nobel[nobel['female_laureates']]
min_row = first_woman[first_woman['year']== first_woman['year'].min()]
first_woman_name, first_woman_category = min_row['full_name'].values[0], min_row['category'].values[0]
print(first_woman_name)
print(first_woman_category)# determine repeat winners
repeat_winners = nobel.groupby('full_name').size().reset_index(name='count')
repeat_list = list(repeat_winners[repeat_winners['count'] >= 2]['full_name'])
repeat_list