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!df2 = pd.read_csv("nobel.csv")df2.describe()df2[["year", "laureate_id"]].head(10)df2.info()# What is the most commonly awarded gender and birth country?
# Store your answers as string variables top_gender and top_country.
top_gender = df2["sex"].value_counts().idxmax()
top_gendersns.countplot(x = "sex", data = df2)
plt.show()top_country = df2["birth_country"].value_counts().idxmax()
top_countryfig, ax = plt.subplots(figsize=(15, 8))
sns.set(font_scale=1.4)
sns.countplot(x = "birth_country", data = df2, ax = ax)
ax.set_xlabel("Countries")
ax.set_ylabel("Number of Awards")
plt.title("Awarded Countries")
plt.xticks(rotation=90, fontsize= 8)
plt.show()# Which decade had the highest ratio of US-born Nobel Prize winners to total winners in all categories?
# Store this as an integer called max_decade_usa.
# Extracting decade from the year
df2['decade'] = (df2['year'] // 10) * 10
df2.head()# Calculate the proportion of USA born winners per decade
df2['us_born'] = df2['birth_country'] == 'United States of America'# Calculate the ratio of U.S.-born laureates to total laureates for each decade
df2['decade'] = (np.floor(df2['year'] / 10) * 10).astype(int)
us_born1 = df2.groupby('decade', as_index = False)['us_born'].mean()print(df2['decade'])# We determined that decade in the previous step and saved it to the variable max_decade.
max_decade_usa = df2[(df2["birth_country"] == "United States of America") & (df2["decade"] == max_decade)].shape[0]
# Now, get the decade with the maximum count and assign it to the variable.
max_decade_usa = df2[df2["birth_country"] == "United States of America"]["decade"].value_counts().idxmax()
max_decade_usa