# import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import numpy as np from pathlib import Path np.set_printoptions(threshold=20)
heart_categorical = ['sex', 'cp', 'ca', 'thal', 'restecg'] a, b, c = 2, 3, 1
fig = plt.figure(figsize=(14, 10), dpi=250)
for i in heart_categorical: plt.subplot(a, b, c) plt.title('{}, subplot:{}{}{}'.format(i, a, b, c)) plt.xlabel(i) sns.countplot(df[i]) c += 1 plt.show()
heart_categorical = ['age', 'trestbps', 'thalach', 'oldpeak'] a, b, c = 4, 3, 1
fig = plt.figure(figsize=(14, 22), dpi=250) for i in heart_categorical: plt.subplot(a, b, c) plt.title('{} (dist), subplot:{}{}{}'.format(i, a, b, c)) plt.xlabel(i) sns.distplot(df[i]) c += 1
plt.subplot(a, b, c) plt.title('{} (box), subplot:{}{}{}'.format(i, a, b, c)) plt.xlabel(i) sns.boxplot(x = df[i]) c += 1
plt.subplot(a, b, c) plt.title('{} (scatter), subplot:{}{}{}'.format(i, a, b, c)) plt.xlabel(i) sns.scatterplot(data=df, x=i, y='chol', hue='sex') c += 1 plt.show()