Skip to content

Instantly share code, notes, and snippets.

@VincentTatan
Last active November 22, 2020 04:40
Show Gist options
  • Save VincentTatan/2477da2417e59b19bec0017db5fb8d96 to your computer and use it in GitHub Desktop.
Save VincentTatan/2477da2417e59b19bec0017db5fb8d96 to your computer and use it in GitHub Desktop.
def draw_plot(df,features,subtitle,figsize=(20,3),type='distplot'):
n_charts = len(features)
fig, axes = plt.subplots(ncols=n_charts,figsize=figsize)
fig.suptitle(subtitle, fontsize=16)
for i in range(n_charts):
feature = features[i-1]
if len(features) >1:
ax=axes[i-1]
else:
ax=axes
if type=='countplot':
sns.countplot(df[feature],ax=ax)
elif type=='distplot':
sns.distplot(df[feature],ax=ax)
df[feature].describe()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment