Creating a count plot
When creating quick analysis of frequency counts, you have been using .value_counts()
. This is a great way for you to see the counts and get an idea of which categories are present in the data. However, sending frequency tables to clients or coworkers may not always be a good idea. For this exercise, you will visualize the number of reviews by their "Score"
. Although "Score"
has been used as a numerical variable in the past, it can be used as a categorical variable given that it has five unique values that are ordered from worst to best. The reviews
dataset has been preloaded.
This exercise is part of the course
Working with Categorical Data in Python
Exercise instructions
- Use the
catplot()
function to display count frequencies using thereviews
dataset. - Count the frequencies for the
"Score"
variable across the x-axis. - When counting the frequencies, color the bars using the
"Traveler type"
column.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
sns.set(font_scale=1.4)
sns.set_style("darkgrid")
# Create a catplot that will count the frequency of "Score" across "Traveler type"
sns.catplot(
____
)
plt.show()