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!

Preparations

Libraries

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

Loading Data into a DataFrame

nobel_df = pd.read_csv("data/nobel.csv")
nobel_df.head()

Questions

What is the most commonly awarded gender and birth country?

  • Store your answers as string variables top_gender and top_country
nobel_df.dtypes
# Solution
top_gender = nobel_df["sex"].value_counts().idxmax()
top_country = nobel_df["birth_country"].value_counts().idxmax()

print(top_gender)
print(top_country)
# Show Data with Seaborn

sns.countplot(x="sex",
              data=nobel_df)

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
  • Note: I removed the last year number, because 1 decade sums up all the years where the first 1 numbers are the same, and the last number is a value between 0 and 9
# Creating a decade column

## Removing last year number by converting to 0
nobel_df["decade"] = np.floor(nobel_df["year"] / 10) * 10

## Controlling the type of the column
print(type(nobel_df["decade"][1]))

## Changing type to int
nobel_df["decade"] = nobel_df["decade"].astype(int)

## Controlling the type of the column
print(type(nobel_df["decade"][1]))
# Calculation of the Ratio USA-winners to total winners

## Creating a column for USA/not USA

nobel_df["usa"] = nobel_df["birth_country"] == "United States of America"

print(nobel_df.head())
## Checking out data, Grouping and counting per decade and USA/non-USA entity 
nobel_df_coutry_per_decade = nobel_df.groupby(["decade","usa"])["usa"].count()

print(nobel_df_coutry_per_decade)
## Calculating the Ratio 

nobel_df_country_per_decade = nobel_df.groupby(["decade", "usa"], as_index=False)["usa"].count()

## Calculating the mean ratio of USA winners per decade
nobel_df_ratio_per_decade = nobel_df_country_per_decade.groupby("decade", as_index=False).mean()

nobel_df_ratio_per_decade
## using a variable for better readabiility
df_ratio = nobel_df_ratio_per_decade

## searching hightes "usa" value and safe the corresponding "decade" value
max_decade_usa = df_ratio[df_ratio["usa"] == df_ratio["usa"].max()]["decade"].values[0]

print(max_decade_usa)