Skip to content

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
from matplotlib import pyplot as plt

# Start coding here!
df=pd.read_csv('nobel.csv')
print(df.head())
#What is the most commonly awarded gender and birth country?

most = df[['sex', 'birth_country']].value_counts()
print(most)
#asnwer
top_gender = 'Male'
top_country = 'United States of America'
#Which decade had the highest ratio of US-born Nobel Prize winners to total winners in all categories?

#I am sampling for only usa wins
usa_df = df[df['birth_country'].isin(['United States of America'])]

#I create 2 series. 1 for sum wins per year, the other for sum usa wins.
total_wins = df.groupby('year')['laureate_id'].agg('count').rename('total_wins')
usa_wins = usa_df.groupby('year')['laureate_id'].agg('count').rename('usa_wins')

#I create a new dataframe, uniting both series on year and adding a ratio column
df1 = pd.concat([total_wins, usa_wins], axis=1)
df1['usa_ratio']=df1['usa_wins']/df1['total_wins']

#I then aggregate the results by decade
df1['decade'] = pd.cut(df1.index, 
                      bins=[1899, 1909, 1919, 1929, 1939, 1949, 1959, 1969, 1979, 1989, 1999, 2009, 2019, 2029], 
                      labels=['1900s', '1910s', '1920s', '1930s', '1940s', '1950s','1960s', '1970s', '1980s', '1990s', '2000s', '2010s', '2020s'])
df2= df1.groupby('decade')['usa_ratio'].sum()
print(df2)

# answer
max_decade_usa = 2000
# Which decade and Nobel Prize category combination had the highest proportion of female laureates?

# I need to add columns 'sex' and 'category' to my decades table.
#print(df1.head())
df3 = pd.merge(df, df1, left_on='year', right_index=True)
#print(df3.head())

# proportion of female laureates
sex = df3.groupby(['decade', 'category', 'sex']).count()
sns.catplot(x='decade', y='year', data=sex, kind='point', hue='sex', row='category')
plt.show()

#answer
max_female_dict = {2020:'Literature'}
#Who was the first woman to receive a Nobel Prize, and in what category?

first_woman = df[df['sex'].isin(['Female'])].sort_values('year')
print(first_woman[['full_name', 'year', 'category']])

first_woman_name = 'Marie Curie, née Sklodowska'
first_woman_category = 'Physics'
#Which individuals or organizations have won more than one Nobel Prize throughout the years?
#I will treat indi and orgaz separately

count_id = df['full_name'].agg(['value_counts'])
count_id = count_id.reset_index()
condition =count_id['value_counts']>1
repeat= count_id[condition]
print(repeat)
#answer
print(*repeat['index'])
repeat_list = ['Comité international de la Croix Rouge (International Committee of the Red Cross)', 'Linus Carl Pauling', 'John Bardeen', 'Frederick Sanger', 'Marie Curie, née Sklodowska', 'Office of the United Nations High Commissioner for Refugees (UNHCR)']