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

#Reading the CSV into the df
nobel_df = pd.read_csv('data/nobel.csv')

#Showing few rows
print(nobel_df.head())

#Showing the schema of the df
print(nobel_df.info())
print("What is the most commonly awarded gender and birth country?")

# Loading in required libraries
import pandas as pd
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt

nobel_df = pd.read_csv('data/nobel.csv')

#Find the most counts(for more info)
#print(nobel_df.value_counts('sex'))
#print(nobel_df.value_counts('birth_country'))

#Subsetting the top count for gender & country
top_gender = nobel_df['sex'].value_counts().index[0]
top_country = nobel_df['birth_country'].value_counts().idxmax()

#Printing the top_values
print("Commonly Awarded Gender:", top_gender)
print("Commonly Awarded Country:", top_country)
print("Which decade had the highest ratio of US-born Nobel Prize winners to total winners in all categories?")

# Loading in required libraries
import pandas as pd
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt

nobel_df = pd.read_csv('data/nobel.csv')

#Calculate the proportion country with decade
nobel_df['USA_Born_Winner'] = nobel_df['birth_country'] == 'United States of America'
nobel_df['Decade'] = (nobel_df['year'] // 10 * 10).astype(int)
prop_usa_winner = nobel_df.groupby('Decade', as_index=False)['USA_Born_Winner'].mean()

max_decade_usa = prop_usa_winner[prop_usa_winner['USA_Born_Winner'] == prop_usa_winner['USA_Born_Winner'].max()]['Decade'].values[0]

print(max_decade_usa)

#Plotting with seaborn
new_plot = sns.relplot(x='Decade', y='USA_Born_Winner', data=prop_usa_winner, kind="line")
plt.show(new_plot)
print("Which decade and Nobel Prize category combination had the highest proportion of female laureates?")

# Loading in required libraries
import pandas as pd
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt

nobel_df = pd.read_csv('data/nobel.csv')

#Calculate the proportion
nobel_df['Female_Winners'] = nobel_df['sex'] == 'Female'
nobel_df['Decade'] = (nobel_df['year'] // 10 * 10).astype(int)
prop_female_winner = nobel_df.groupby(['Decade', 'category'], as_index=False)['Female_Winners'].mean()

#Calculating maximum female winners for which decade & category
max_decade_female_category = prop_female_winner[prop_female_winner['Female_Winners'] == prop_female_winner['Female_Winners'].max()][['Decade', 'category']]

print(max_decade_female_category)

#Final Dictionary
max_female_dict = {max_decade_female_category['Decade'].values[0]: max_decade_female_category['category'].values[0]}
print("Decade / Category Dict. for Maximum Female Winners:", max_female_dict)

#Plotting with seaborn
new_plot2= sns.relplot(x='Decade', y='Female_Winners', data=prop_female_winner, kind="line", hue='category')
plt.show(new_plot2)

#1st Woman to win nobel prize and the category
nobel_women = nobel_df[nobel_df['Female_Winners']]
min_value= nobel_women[nobel_women['year'] == nobel_women['year'].min()] 
first_woman_name = min_value['full_name'].values[0]
first_woman_category = min_value['category'].values[0]
print(f"\n The first woman to win a Nobel Prize was {first_woman_name}, in the category of {first_woman_category}.")
print("Which individuals or organizations have won more than one Nobel Prize throughout the years?")

# Loading in required libraries
import pandas as pd
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt

nobel_df = pd.read_csv('data/nobel.csv')

#Calculate the repeat list
counts = nobel_df['full_name'].value_counts()
greater_than_2 = counts[counts >=2].index
repeat_list = list(greater_than_2)

print("The repeat winners are :",repeat_list)