Skip to content

Instantly share code, notes, and snippets.

@danyashorokh
Created October 9, 2018 10:03
Show Gist options
  • Save danyashorokh/77e3a65681c370f97cd0be009c148136 to your computer and use it in GitHub Desktop.
Save danyashorokh/77e3a65681c370f97cd0be009c148136 to your computer and use it in GitHub Desktop.
[Python] Plot all features
# %matplotlib inline
from matplotlib import pyplot as plt
plt.rcParams['figure.figsize'] = (10, 8)
fig = plt.figure(figsize=(25, 15))
cols = 5
rows = np.ceil(float(data_train.shape[1]) / cols)
for i, column in enumerate(data_train.columns):
ax = fig.add_subplot(rows, cols, i + 1)
ax.set_title(column)
if data_train.dtypes[column] == np.object:
data_train[column].value_counts().plot(kind="bar", axes=ax)
else:
data_train[column].hist(axes=ax)
plt.xticks(rotation="vertical")
plt.subplots_adjust(hspace=0.7, wspace=0.2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment