Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Proportion of Females | Conducting Exploratory Data Analysis of Nobel Prizes
Conducting Exploratory Data Analysis of Nobel Prizes

book
Proportion of Females

We aim to analyze the gender distribution across all categories of the awards, including Economic Sciences, Physics, Chemistry, Peace, Physiology or Medicine, and Literature, to identify which gender predominates in each field.

Taak

Swipe to start coding

  1. Create a new column in the nobel DataFrame that identifies if a laureate is female.

  2. Calculate the decade for each Nobel Prize award.

  3. Compute the proportion of female winners for each decade and category.

  4. Plot the proportion of female winners per decade by categories.

Oplossing

# Create a new column to identify if the laureate is female
nobel["female_winner"] = nobel["gender"] == "female"

# Calculate the decade for each Nobel Prize award
nobel["decade"] = nobel["awardYear"] // 10 * 10

# Compute the proportion of female winners for each decade and category
prop_female_winners = nobel.groupby(["decade", "category"], as_index=False)["female_winner"].mean()

# Plot the proportion of female winners per decade by categories
plt.figure(figsize=(10, 5))
sns.barplot(x="decade", y="female_winner", hue="category", data=prop_female_winners)
plt.title("The proportion of female winners per decade by categories")
plt.ylabel("Female winners ratio")
plt.xlabel("Decade")
plt.legend(loc="upper left")
plt.show()

Mark tasks as Completed
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 4
AVAILABLE TO ULTIMATE ONLY
some-alt