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!
    #Importing and getting to know the data
    nobel = pd.read_csv("data/nobel.csv")
    print(nobel.head())
    print(nobel.info())
    # Find most awarded gender and country
    gender_mode = nobel["sex"].mode()
    country_mode = nobel["birth_country"].mode()
    
    # Convert to strings
    top_gender = str(gender_mode[0])
    top_country = str(country_mode[0])
    
    # Display
    print(top_gender)
    print(top_country)
    
    
    
    
    # Create boolean column for US winners
    nobel['us_winners'] = nobel['birth_country'] == "United States of America"
    
    # Create decades column
    nobel['decade'] = (np.floor(nobel['year'] / 10) * 10).astype(int)
    
    # Group by decade and select max
    group = nobel.groupby('decade', as_index=False)['us_winners'].mean()
    max_decade = group[group['us_winners'] == group['us_winners'].max()]
    max_decade_usa = max_decade['decade'].values[0]
    
    
    print(max_decade_usa)
    
    # Create boolean column is_female
    nobel['is_female'] = nobel['sex'] == 'Female'
    
    # Group by decade and select max
    female_group = nobel.groupby(['decade', 'category'],as_index=False)['is_female'].agg(np.mean)
    best_decade = female_group[female_group['is_female'] == max(female_group['is_female'])]
    
    # Create dictionary
    max_female_dict = {best_decade.values[0,0] : best_decade.values[0,1]}
    
    print(max_female_dict)
    
    # First female winner
    female = nobel[nobel['sex'] == 'Female']
    first_female = female[female['year'] == min(female['year'])]
    
    # Get name and category
    first_woman_name = first_female['full_name'].values[0]
    first_woman_category = first_female['category'].values[0]
    
    print(first_woman_name)
    print(first_woman_category)
    counts= nobel['full_name'].value_counts()
    repeat_list= list(counts[counts > 1].index)
    
    print(repeat_list)