MulaiMulai sekarang secara gratis

Creating boxplots

Let's get back to our heroes dataset. As we previously discovered, the BMI index is in average much higher for villains than for good characters (taking into account only Marvel and DC publishers). Your task is to plot the corresponding distributions of BMI indices using boxplots.

Tip: to select rows in a DataFrame, for which a specific column follows a certain condition, use this expression dataframe[condition for column_name] (e.g. heroes[heroes['Alignment'] == 'good'] selects rows that have a 'good' Alignment in the heroes dataset).

Latihan ini adalah bagian dari kursus

Practicing Coding Interview Questions in Python

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

import seaborn as sns

# Create a boxplot of BMI indices for 'good' and 'bad' sides
____
plt.show()
Edit dan Jalankan Kode