Heart Attack Analysis & Prediction Dataset¶

As heart attacks can be unpredictable and life threatening, this project will focus on using a variety of physical attributes to predict if someone has a high chance of having a heart attack. Perhaps this prediction can lead someone to be more careful with their health and encourage them to take any precautions they can to keep themselves safe and healthy.

HeartDataset

Features of Heart Attack Analysis & Prediction Dataset¶

  • Age : Age of the patient

  • Sex : Sex of the patient

  • exang: exercise induced angina (1 = yes; 0 = no)

  • ca: number of major vessels (0-3)

  • cp : Chest Pain type chest pain type

    • Value 1: typical angina
    • Value 2: atypical angina
    • Value 3: non-anginal pain
    • Value 4: asymptomatic
  • trtbps : resting blood pressure (in mm Hg)

  • chol : cholestoral in mg/dl fetched via BMI sensor

  • fbs : (fasting blood sugar > 120 mg/dl) (1 = true; 0 = false)

  • rest_ecg : resting electrocardiographic results

    • Value 0: normal
    • Value 1: having ST-T wave abnormality (T wave inversions and/or ST elevation or depression of > 0.05 mV)
    • Value 2: showing probable or definite left ventricular hypertrophy by Estes' criteria
  • thalach : maximum heart rate achieved

  • target :

    • 0= less chance of heart attack
    • 1= more chance of heart attack
In [4]:
import pandas as pd
data = pd.read_csv('heart.csv')
print(data.shape)
data.head()
(303, 14)
Out[4]:
age sex cp trtbps chol fbs restecg thalachh exng oldpeak slp caa thall output
0 63 1 3 145 233 1 0 150 0 2.3 0 0 1 1
1 37 1 2 130 250 0 1 187 0 3.5 0 0 2 1
2 41 0 1 130 204 0 0 172 0 1.4 2 0 2 1
3 56 1 1 120 236 0 1 178 0 0.8 2 0 2 1
4 57 0 0 120 354 0 1 163 1 0.6 2 0 2 1

The data will be used to find common characteristics in people with a high chance of having a heart attack. The data will also be split into a train and test set so that we can train a model to predict whether a person is likely to have a heart attack based on a given set of features.