Skip to content
Project: Visualizing the History of Nobel Prize Winners
  • AI Chat
  • Code
  • Report
  • 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
    
    # Start coding here!
    file_path = 'data/nobel.csv'
    nobel = pd.read_csv(file_path, index_col=0)
    print(nobel)  
    
    # Task 1 (a)
    nobel_gender = nobel["sex"].value_counts(sort=True)
    #print('\n', nobel_gender)
    top_gender = 'Male'
    
    # Task 1 (b)
    nobel_country = nobel["birth_country"].value_counts(sort=True)
    #print('\n', nobel_country)
    top_country = 'United States of America'
    
    # Task 2
    nobel['decade'] = (nobel.index // 10) * 10
    #print('\n', nobel['decade'])
    
    nobel_decade_countries = nobel.groupby(['decade', 'birth_country'])['birth_country'].count().groupby(level=0).apply(lambda x: x / x.sum())
    #print('\n', nobel_decade_countries)
    nobel_decade_country_usa = nobel_decade_countries.loc[(slice(None), 'United States of America')] # Filters for the rows that only display the proportion of winners that were born in the USA
    #print('\n', nobel_decade_country_usa)
    
    max_decade_usa = 2000
    
    # Task 3
    nobel_pair = nobel[['decade', 'category', 'sex']]
    #print('\n', nobel_pair)
    nobel_pair_female = (nobel_pair[nobel_pair['sex'] == 'Female'].groupby(['decade', 'category']).size()) / nobel_pair.groupby(['decade', 'category'])['sex'].size() # Calculates the proportion of female laureats
    #print('\n', nobel_pair_female.reset_index())
    print(nobel_pair_female.sort_values(ascending = False))
    
    max_female_dict = {2020: 'Literature'}
    
    # Task 4
    nobel_first_female = nobel[nobel['sex'] == 'Female']
    print(nobel_first_female[['category', 'full_name', 'sex']])
    #print('\n', nobel_first_female['full_name'])
    
    first_woman_category = 'Physics'
    
    # Task 5
    nobel_multiple_names = nobel[nobel['full_name'].duplicated()]  # Corrected the code to check for duplicated names
    nobel_multiple_names_list = nobel_multiple_names['full_name'].tolist()
    
    repeat_list = list(set(nobel_multiple_names_list))
    print('\n', repeat_list)
    
    first_woman_name = repeat_list[0]
    print('\n', first_woman_name)
    
    print('\n', nobel.columns)