text_plain_output_1.png image_output_1.png
import pandas as pd

csv_path = '/kaggle/input/heart-failure-prediction/heart.csv'
hrz = pd.read_csv(csv_path)

print('MaxHR values for F, M:')
print('HeartDisease=0', round(hrz.loc[(hrz['Sex'] == 'F') & (hrz['HeartDisease'] == 0)]['MaxHR'].mean(), 2), round(hrz.loc[(hrz['Sex'] == 'M') & (hrz['HeartDisease'] == 0)]['MaxHR'].mean(), 2))
print('HeartDisease=1', round(hrz.loc[(hrz['Sex'] == 'F') & (hrz['HeartDisease'] == 1)]['MaxHR'].mean(), 2), round(hrz.loc[(hrz['Sex'] == 'M') & (hrz['HeartDisease'] == 1)]['MaxHR'].mean(), 2))
print('Oldpeak values for F, M:')
print('HeartDisease=0', round(hrz.loc[(hrz['Sex'] == 'F') & (hrz['HeartDisease'] == 0)]['Oldpeak'].mean(), 2), round(hrz.loc[(hrz['Sex'] == 'M') & (hrz['HeartDisease'] == 0)]['Oldpeak'].mean(), 2))
print('HeartDisease=1', round(hrz.loc[(hrz['Sex'] == 'F') & (hrz['HeartDisease'] == 1)]['Oldpeak'].mean(), 2), round(hrz.loc[(hrz['Sex'] == 'M') & (hrz['HeartDisease'] == 1)]['Oldpeak'].mean(), 2))