Get startedGet started for free

Visualizing many categories

So far in this chapter, we've only considered the case of differences in a numeric variable between two categories. Of course, many datasets contain more categories. Before you get to conducting tests on many categories, it's often helpful to perform exploratory data analysis (EDA), calculating summary statistics for each group and visualizing the distributions of the numeric variable for each category using box plots.

Here, we'll return to the late shipments data, and how the price of each package (pack_price) varies between the three shipment modes (shipment_mode): "Air", "Air Charter", and "Ocean".

late_shipments is available; pandas and matplotlib.pyplot are loaded with their standard aliases, and seaborn is loaded as sns.

This exercise is part of the course

Hypothesis Testing in Python

View Course

Hands-on interactive exercise

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

# Calculate the mean pack_price for each shipment_mode
xbar_pack_by_mode = ____

# Print the grouped means
print(xbar_pack_by_mode)
Edit and Run Code