Get Started

Omitting outliers

Now let's use the student_data dataset to compare the distribution of final grades ("G3") between students who have internet access at home and those who don't. To do this, we'll use the "internet" variable, which is a binary (yes/no) indicator of whether the student has internet access at home.

Since internet may be less accessible in rural areas, we'll add subgroups based on where the student lives. For this, we can use the "location" variable, which is an indicator of whether a student lives in an urban ("Urban") or rural ("Rural") location.

Seaborn has already been imported as sns and matplotlib.pyplot has been imported as plt. As a reminder, you can omit outliers in box plots by setting the sym parameter equal to an empty string ("").

This is a part of the course

“Introduction to Data Visualization with Seaborn”

View Course

Exercise instructions

  • Use sns.catplot() to create a box plot with the student_data DataFrame, putting "internet" on the x-axis and "G3" on the y-axis.
  • Add subgroups so each box plot is colored based on "location".
  • Do not display the outliers.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Create a box plot with subgroups and omit the outliers






# Show plot
plt.show()
Edit and Run Code