BaşlayınÜcretsiz Başlayın

Creating a bar plot

Las Vegas hotels are seeing large variations in how helpful reviews appear to other people. The owners of these hotels are curious if there are times of the year when reviews have been more helpful to their potential guests. Help the owners understand their reviews better by creating a bar plot of the average number of helpful votes per review across the categorical variable "Period of stay". The dataset reviews has been preloaded for you.

Bu egzersiz

Working with Categorical Data in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Print out the frequency counts of the variable "Period of stay" to make sure each category has data.
  • Create a bar plot using catplot().
  • Split the reviews dataset on "Period of stay" across the x-axis.
  • Specify the numerical variable to aggregate on as "Helpful votes".

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Print the frequency counts of "Period of stay"
print(reviews[____].____)

sns.set(font_scale=1.4)
sns.set_style("whitegrid")

# Create a bar plot of "Helpful votes" by "Period of stay"
sns.catplot(____)
plt.show()
Kodu Düzenle ve Çalıştır