Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте 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.

Завдання

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.

Рішення

# 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
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 4
AVAILABLE TO ULTIMATE ONLY
some-alt