countplot in pandas code example

Example 1: countplot in pandas

>>> import seaborn as sns
>>> sns.set_theme(style="darkgrid")
>>> titanic = sns.load_dataset("titanic")
>>> ax = sns.countplot(x="class", data=titanic)

Example 2: countplot for different classes in a column

>>> ax = sns.countplot(x="who", data=titanic, palette="Set3")

Example 3: countplot

A countplot is kind of likea histogram or a bar graph for some categorical area. ... You put this statement in if you are using an editor such as jupyter notebooks so that you can see the graph output in the editor. Seaborn already has built-in data sets. One data set that can be used is tips.

Tags:

Misc Example