One visualization per group
While working on a data exploration project, you have been asked to visualize the number of reviews of hotels by "Period of stay"
and by the day of the week, "Review weekday"
. The goal of this visualization is to see what day of the week has the most reviews for each of the four periods of stay. The reviews
dataset has been preloaded for you, as well as both seaborn
, as sns
, and matplotlib.pyplot
as plt
.
This exercise is part of the course
Working with Categorical Data in Python
Exercise instructions
- Create a
catplot()
using"count"
as the type of graphic. - Count the number of reviews by
"Review weekday"
. - Create individual plots for each
"Period of stay"
. - Wrap the plots after every 2nd graphic.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Create a catplot for each "Period of stay" broken down by "Review weekday"
ax = sns.catplot(
# Make sure Review weekday is along the x-axis
____,
# Specify Period of stay as the column to create individual graphics for
____,
# Specify that a count plot should be created
____,
# Wrap the plots after every 2nd graphic.
____,
data=reviews
)
plt.show()