Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
孊ぶ Counting Categorical Data | Section
Statistical Visualization with Seaborn

Counting Categorical Data

メニュヌを衚瀺するにはスワむプしおください

A countplot is a plot that takes a categorical list and returns columns that represent the number of list entries for each category.

12345678910111213
# Importing the `seaborn` library import seaborn as sns # Importing `matplotlib.pyplot` import matplotlib.pyplot as plt # Data list data_list = ['apple', 'milk', 'milk', 'milk', 'apple', 'milk', 'milk', 'milk', 'fish'] # Creating the countplot sns.countplot(x=data_list, palette='mako') # Showing the plot plt.show()

To initialize a countplot, you need to input at least 1 parameter: x (the column in which values will be counted).

Note
Note

You may also use y instead of x to change the orientation of the plot.

As seaborn is based on matplotlib, you may use a special matplotlib.pyplot library and its function plt.show() to show the plot.

タスク

スワむプしおコヌディングを開始

  1. Import the seaborn library with the sns alias;
  2. Import the matplotlib.pyplot library with the plt alias;
  3. Initialize the x-oriented countplot for guests_list;
  4. Show the plot.

解答

Switch to desktop実践的な緎習のためにデスクトップに切り替える䞋蚘のオプションのいずれかを利甚しお、珟圚の堎所から続行する
すべお明確でしたか

どのように改善できたすか

フィヌドバックありがずうございたす

セクション 1. 章 3
single

single

AIに質問する

expand

AIに質問する

ChatGPT

䜕でも質問するか、提案された質問の1぀を詊しおチャットを始めおください

some-alt