Heart Attack Dataset Analysis
This is notebook is for analysing the Heart Attack dataset in kaggle (https://www.kaggle.com/rashikrahmanpritom/heart-attack-analysis-prediction-dataset)
This notebook goes through each and every available variable that might contribute to the probability of a heart attack and gives an estimation of the values that might lead to a heart attack for every variable.
O2 saturation Data
We can notice here that there isn't much variation in the levels of O2 saturation, and that there are only 17 unique values in our dataset.
Through these previous blocks of code, we can conclude that the standard level of O2 saturation ranges from 96.5 to 98.6
3184
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 3585 entries, 0 to 3584
Data columns (total 1 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 98.6 3585 non-null float64
dtypes: float64(1)
memory usage: 28.1 KB
Since the values ranging from 96.5 to 98.6 represent 88.81% of the values then it's safe to assume that usual values are these values, adding that the most common one out of them is 96.5
Heart Attack Dataset
Data preparation
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 242 entries, 0 to 241
Data columns (total 14 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 age 242 non-null int64
1 sex 242 non-null int64
2 cp 242 non-null int64
3 trtbps 242 non-null int64
4 chol 242 non-null int64
5 fbs 242 non-null int64
6 restecg 242 non-null int64
7 thalachh 242 non-null int64
8 exng 242 non-null int64
9 oldpeak 242 non-null float64
10 slp 242 non-null int64
11 caa 242 non-null int64
12 thall 242 non-null int64
13 output 242 non-null int64
dtypes: float64(1), int64(13)
memory usage: 26.6 KB
There output reprsents whether the person had a heart-attack (output=1) or not (output=0)
Data analysis
Sex variable
Age variable
91.72932330827068
CP variable
The cp column represents the chest pain type
Value 1: typical angina which is defined as substernal chest pain precipitated by physical exertion or emotional stress and relieved with rest or nitroglycerin
Value 2: atypical angina (Unlike typical chest pain, which is usually a dull pain or pressure sensation, atypical chest pain may be sharp, stabbing, or tearing. Atypical chest pain may get worse when breathing in, may get better with leaning forward, and may be worse when you push on the chest)
Value 3: non-anginal pain
Value 4: asymptomatic
Trtbps variable
82.70676691729322
Since the most of the values of the trtbps index range from 110 to 150(around 82.70%) it is safe to assume that most of heart attacks are associated with a blood pressure between 110 and 150
chol variable
85.71428571428571 %
fbs variable
REST ECG variable
Thalach variable
87.21804511278195 %
exng variable
slp variable
caa variable
caa - number of major vessels (0-4) colored by flourosopy
thall variable
thal - 2 = normal; 1 = fixed defect; 3 = reversable defect
Most of the individuals who had heart attack (around 80% of them) had a value of 2 for the thall followed by 11% that had a value of 3