text_plain_output_2.png text_plain_output_1.png
import matplotlib.pyplot as plt

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import seaborn as sns

heart = pd.read_csv('../input/heart.csv')

heart.nunique()

heart.columns = ['Age', 'Gender', 'ChestPain', 'RestingBloodPressure', 'Cholestrol', 'FastingBloodSugar', 'RestingECG', 'MaxHeartRateAchivied', 'ExerciseIndusedAngina', 'Oldpeak', 'Slope', 'MajorVessels', 'Thalassemia', 'Target']

bg_color = (0.25, 0.25, 0.25)
sns.set(rc={'font.style': 'normal', 'axes.facecolor': bg_color, 'figure.facecolor': bg_color, 'text.color': 'white', 'xtick.color': 'white', 'ytick.color': 'white', 'axes.labelcolor': 'white', 'axes.grid': False, 'axes.labelsize': 25, 'figure.figsize': (10.0, 5.0), 'xtick.labelsize': 15, 'ytick.labelsize': 15})

result = []
for i in heart['ChestPain']:
    if i == 0:
        result.append('Typical Angina')
    if i == 1:
        result.append('Atypical Angina')
    if i == 2:
        result.append('Non-Anginal')
    if i == 3:
        result.append('Asymptomatic')
heart['ChestPainType'] = result

ax = sns.countplot(hue=result, x='Gender', data=heart, palette='husl')
plt.title('Chest Pain Type Vs Gender')
plt.ylabel('')
plt.yticks([])
plt.xlabel('')
ax.set_xticklabels(['Female', 'Male'])
print(ax.patches)