/ Python And R Data science skills: 87 Categorical Plots

Sunday 18 February 2018

87 Categorical Plots

https://vlrtraining.com/courses/python-data-science-beginner-tutorial 87 Categorical Plots

Categorical Data Plots

  • factorplot
  • boxplot
  • violinplot
  • stripplot
  • swarmplot
  • barplot
  • countplot
In [6]:
import seaborn as sns
%matplotlib inline
tips = sns.load_dataset('tips')
tips.head(1)
Out[6]:
total_bill tip sex smoker day time size
0 16.99 1.01 Female No Sun Dinner 2

barplot and countplot

These very similar plots allow you to get aggregate data off a categorical feature in your data. barplot is a general plot that allows you to aggregate the categorical data based off some function, by default the mean:

In [9]:
sns.barplot(x='sex',y='total_bill',data=tips)
Out[9]:
<matplotlib.axes._subplots.AxesSubplot at 0xb7d0198>
In [11]:
sns.barplot(x='sex',y='size',data=tips)
Out[11]:
<matplotlib.axes._subplots.AxesSubplot at 0xbad8a90>
In [7]:
sns.barplot(x='sex',y='total_bill',data=tips,estimator=np.std)
Out[7]:
<matplotlib.axes._subplots.AxesSubplot at 0xb26dba8>
In [4]:
import numpy as np
In [12]:
sns.barplot(x='sex',y='total_bill',data=tips,estimator=np.std)
Out[12]:
<matplotlib.axes._subplots.AxesSubplot at 0xbae4630>

No comments:

Post a Comment