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
nobel_df = pd.read_csv("data/nobel.csv")
nobel_df.head()
sns.catplot(x="sex",data=nobel_df,kind="count")
From the visualization obove you can see, that most commonly awarded gender is male.
top_gender= nobel_df["sex"].value_counts().index[0]
#all birth_countries
bc = nobel_df["birth_country"].unique()
print("the were ",len(bc), "different birth countries")
#top 10 bith countries
bc = nobel_df["birth_country"].value_counts()
#print(top_10_bc)
bc_df = bc.reset_index()
top_10_bc_df = bc_df.head(10)
print(top_10_bc_df)
top_10_bc_df.columns=["birth_country","count"]
fig = sns.catplot(x="birth_country",y="count",data=top_10_bc_df, kind="bar", color="b")
fig.set_xticklabels(rotation=90)
top_country = nobel_df["birth_country"].value_counts().index[0]
print("The the most commonly awarded country ist : ",top_country)
#Add a column "decade" to nobel_df as a flag
decade = []
for index, var in nobel_df.iterrows():
dec = int((var["year"] - 1900)/10)
decade.append(dec)
nobel_df["decade"] = decade
nobel_df.head(200)
#identify which winner was born in USA
us_born_winner = nobel_df["birth_country"] == top_country
nobel_df["us_born_winner"] = us_born_winner
dec_ratio = nobel_df.groupby("decade", as_index=False)["us_born_winner"].mean()
#max_decade_usa = dec_ratio[dec_ratio["us_born_winner"] == dec_ratio["us_born_winner"].max()]
#print(max_decade_usa)
max_decade_usa = int(dec_ratio.loc[dec_ratio["us_born_winner"].idxmax()]["decade"] *10+1900)
print(max_decade_usa )
print("The highest decade ratio of US-born winners is ", max_decade_usa)
#test = nobel_df.query('decade == 0 & us_born_winner == False')
#print(test)
#1/57
sns.catplot(x="decade",y="us_born_winner",kind="bar",data=nobel_df, ci = None)
#deacde, category, female proportion
female = nobel_df["sex"] == 'Female'
nobel_df["female"] = female
dec_female_cat = nobel_df.groupby(["decade","category"], as_index = False)["female"].mean()
max_female_cat = dec_female_cat[dec_female_cat["female"] == dec_female_cat["female"].max()]
print(max_female_cat))
#max_female_dict = {max_female_cat["decade"].values[0] : max_female_cat["category"].values[0]}
#print("The highest proportiof of female winners:",max_female_dict)
female_df = nobel_df[nobel_df["female"] == True]
#print(female_df)
min_row = female_df[female_df["year"] == female_df["year"].min()]
#print(min_row)
first_woman_name = min_row["full_name"].values[0]
first_woman_cat = min_row["category"].values[0]
#print(first_woman_name, first_woman_cat)
repeate = nobel_df[["full_name"]].value_counts()
repeate_df = repeate.reset_index()
repeate_df.columns = ["full_name","count"]
more_then_one = repeate_df.query('count > 1')
repeate_list = more_then_one["full_name"].values
print(repeate_list)