Creating a point plot
Creating helpful visualizations sometimes requires a lot of testing. You have been asked to create a visualization that shows the number of reviews, "Nr. reviews"
, which is the number of reviews a reviewer has previously written, across a hotel's star rating, "Hotel stars"
. Since the number of reviews is numerical, you have decided to use a point plot to show the mean of the data across the categories.
This exercise is part of the course
Working with Categorical Data in Python
Exercise instructions
- Using the
catplot()
function, create a point plot. - Split the data across the x-axis using
"Hotel stars"
. - Specify the numerical variable to visualize to
"Nr. reviews"
. - Update the arguments so that any lines that appear do not overlap.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Create a point plot with catplot using "Hotel stars" and "Nr. reviews"
sns.catplot(
# Split the data across Hotel stars and summarize Nr. reviews
____,
____,
data=reviews,
# Specify a point plot
____,
hue="Pool",
# Make sure the lines and points don't overlap
____
)
plt.show()