MulaiMulai sekarang secara gratis

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.

Latihan ini adalah bagian dari kursus

Working with Categorical Data in Python

Lihat Kursus

Petunjuk latihan

  • Use the catplot() function to display count frequencies using the reviews dataset.
  • Count the frequencies for the "Score" variable across the x-axis.
  • When counting the frequencies, color the bars using the "Traveler type" column.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

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()
Edit dan Jalankan Kode