Datasets:
id int64 | gender string | age float64 | hypertension int64 | heart_disease int64 | ever_married string | work_type string | Residence_type string | avg_glucose_level float64 | bmi float64 | smoking_status string | stroke int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|
9,046 | Male | 67 | 0 | 1 | Yes | Private | Urban | 228.69 | 36.6 | formerly smoked | 1 |
51,676 | Female | 61 | 0 | 0 | Yes | Self-employed | Rural | 202.21 | null | never smoked | 1 |
31,112 | Male | 80 | 0 | 1 | Yes | Private | Rural | 105.92 | 32.5 | never smoked | 1 |
60,182 | Female | 49 | 0 | 0 | Yes | Private | Urban | 171.23 | 34.4 | smokes | 1 |
1,665 | Female | 79 | 1 | 0 | Yes | Self-employed | Rural | 174.12 | 24 | never smoked | 1 |
56,669 | Male | 81 | 0 | 0 | Yes | Private | Urban | 186.21 | 29 | formerly smoked | 1 |
53,882 | Male | 74 | 1 | 1 | Yes | Private | Rural | 70.09 | 27.4 | never smoked | 1 |
10,434 | Female | 69 | 0 | 0 | No | Private | Urban | 94.39 | 22.8 | never smoked | 1 |
27,419 | Female | 59 | 0 | 0 | Yes | Private | Rural | 76.15 | null | Unknown | 1 |
60,491 | Female | 78 | 0 | 0 | Yes | Private | Urban | 58.57 | 24.2 | Unknown | 1 |
12,109 | Female | 81 | 1 | 0 | Yes | Private | Rural | 80.43 | 29.7 | never smoked | 1 |
12,095 | Female | 61 | 0 | 1 | Yes | Govt_job | Rural | 120.46 | 36.8 | smokes | 1 |
12,175 | Female | 54 | 0 | 0 | Yes | Private | Urban | 104.51 | 27.3 | smokes | 1 |
8,213 | Male | 78 | 0 | 1 | Yes | Private | Urban | 219.84 | null | Unknown | 1 |
5,317 | Female | 79 | 0 | 1 | Yes | Private | Urban | 214.09 | 28.2 | never smoked | 1 |
58,202 | Female | 50 | 1 | 0 | Yes | Self-employed | Rural | 167.41 | 30.9 | never smoked | 1 |
56,112 | Male | 64 | 0 | 1 | Yes | Private | Urban | 191.61 | 37.5 | smokes | 1 |
34,120 | Male | 75 | 1 | 0 | Yes | Private | Urban | 221.29 | 25.8 | smokes | 1 |
27,458 | Female | 60 | 0 | 0 | No | Private | Urban | 89.22 | 37.8 | never smoked | 1 |
25,226 | Male | 57 | 0 | 1 | No | Govt_job | Urban | 217.08 | null | Unknown | 1 |
70,630 | Female | 71 | 0 | 0 | Yes | Govt_job | Rural | 193.94 | 22.4 | smokes | 1 |
13,861 | Female | 52 | 1 | 0 | Yes | Self-employed | Urban | 233.29 | 48.9 | never smoked | 1 |
68,794 | Female | 79 | 0 | 0 | Yes | Self-employed | Urban | 228.7 | 26.6 | never smoked | 1 |
64,778 | Male | 82 | 0 | 1 | Yes | Private | Rural | 208.3 | 32.5 | Unknown | 1 |
4,219 | Male | 71 | 0 | 0 | Yes | Private | Urban | 102.87 | 27.2 | formerly smoked | 1 |
70,822 | Male | 80 | 0 | 0 | Yes | Self-employed | Rural | 104.12 | 23.5 | never smoked | 1 |
38,047 | Female | 65 | 0 | 0 | Yes | Private | Rural | 100.98 | 28.2 | formerly smoked | 1 |
61,843 | Male | 58 | 0 | 0 | Yes | Private | Rural | 189.84 | null | Unknown | 1 |
54,827 | Male | 69 | 0 | 1 | Yes | Self-employed | Urban | 195.23 | 28.3 | smokes | 1 |
69,160 | Male | 59 | 0 | 0 | Yes | Private | Rural | 211.78 | null | formerly smoked | 1 |
43,717 | Male | 57 | 1 | 0 | Yes | Private | Urban | 212.08 | 44.2 | smokes | 1 |
33,879 | Male | 42 | 0 | 0 | Yes | Private | Rural | 83.41 | 25.4 | Unknown | 1 |
39,373 | Female | 82 | 1 | 0 | Yes | Self-employed | Urban | 196.92 | 22.2 | never smoked | 1 |
54,401 | Male | 80 | 0 | 1 | Yes | Self-employed | Urban | 252.72 | 30.5 | formerly smoked | 1 |
14,248 | Male | 48 | 0 | 0 | No | Govt_job | Urban | 84.2 | 29.7 | never smoked | 1 |
712 | Female | 82 | 1 | 1 | No | Private | Rural | 84.03 | 26.5 | formerly smoked | 1 |
47,269 | Male | 74 | 0 | 0 | Yes | Private | Rural | 219.72 | 33.7 | formerly smoked | 1 |
24,977 | Female | 72 | 1 | 0 | Yes | Private | Rural | 74.63 | 23.1 | formerly smoked | 1 |
47,306 | Male | 58 | 0 | 0 | No | Private | Rural | 92.62 | 32 | Unknown | 1 |
62,602 | Female | 49 | 0 | 0 | Yes | Private | Urban | 60.91 | 29.9 | never smoked | 1 |
4,651 | Male | 78 | 0 | 0 | Yes | Private | Rural | 78.03 | 23.9 | formerly smoked | 1 |
1,261 | Male | 54 | 0 | 0 | Yes | Private | Urban | 71.22 | 28.5 | never smoked | 1 |
61,960 | Male | 82 | 0 | 1 | Yes | Private | Urban | 144.9 | 26.4 | smokes | 1 |
1,845 | Female | 63 | 0 | 0 | Yes | Private | Urban | 90.9 | null | formerly smoked | 1 |
7,937 | Male | 60 | 1 | 0 | Yes | Govt_job | Urban | 213.03 | 20.2 | smokes | 1 |
19,824 | Male | 76 | 1 | 0 | Yes | Private | Rural | 243.58 | 33.6 | never smoked | 1 |
37,937 | Female | 75 | 0 | 1 | No | Self-employed | Urban | 109.78 | null | Unknown | 1 |
47,472 | Female | 58 | 0 | 0 | Yes | Private | Urban | 107.26 | 38.6 | formerly smoked | 1 |
35,626 | Male | 81 | 0 | 0 | Yes | Self-employed | Urban | 99.33 | 33.7 | never smoked | 1 |
36,338 | Female | 39 | 1 | 0 | Yes | Private | Rural | 58.09 | 39.2 | smokes | 1 |
18,587 | Female | 76 | 0 | 0 | No | Private | Urban | 89.96 | null | Unknown | 1 |
15,102 | Male | 78 | 1 | 0 | Yes | Private | Urban | 75.32 | null | formerly smoked | 1 |
59,190 | Female | 79 | 0 | 1 | Yes | Private | Rural | 127.29 | 27.7 | never smoked | 1 |
47,167 | Female | 77 | 1 | 0 | Yes | Self-employed | Urban | 124.13 | 31.4 | never smoked | 1 |
8,752 | Female | 63 | 0 | 0 | Yes | Govt_job | Urban | 197.54 | null | never smoked | 1 |
25,831 | Male | 63 | 0 | 1 | Yes | Private | Rural | 196.71 | 36.5 | formerly smoked | 1 |
38,829 | Female | 82 | 0 | 0 | Yes | Private | Rural | 59.32 | 33.2 | never smoked | 1 |
66,400 | Male | 78 | 0 | 0 | Yes | Private | Urban | 237.75 | null | formerly smoked | 1 |
58,631 | Male | 73 | 1 | 0 | Yes | Self-employed | Urban | 194.99 | 32.8 | never smoked | 1 |
5,111 | Female | 54 | 1 | 0 | Yes | Govt_job | Urban | 180.93 | 27.7 | never smoked | 1 |
10,710 | Female | 56 | 0 | 0 | Yes | Private | Urban | 185.17 | 40.4 | formerly smoked | 1 |
55,927 | Female | 80 | 1 | 0 | Yes | Private | Rural | 74.9 | 22.2 | never smoked | 1 |
65,842 | Female | 67 | 1 | 0 | Yes | Self-employed | Rural | 61.94 | 25.3 | smokes | 1 |
19,557 | Female | 45 | 0 | 0 | Yes | Private | Rural | 93.72 | 30.2 | formerly smoked | 1 |
7,356 | Male | 75 | 0 | 0 | Yes | Private | Urban | 104.72 | null | Unknown | 1 |
17,013 | Male | 78 | 1 | 0 | No | Private | Urban | 113.01 | 24 | never smoked | 1 |
17,004 | Female | 70 | 0 | 0 | Yes | Private | Urban | 221.58 | 47.5 | never smoked | 1 |
72,366 | Male | 76 | 0 | 0 | Yes | Private | Urban | 104.47 | 20.3 | Unknown | 1 |
6,118 | Male | 59 | 0 | 0 | Yes | Private | Urban | 86.23 | 30 | formerly smoked | 1 |
7,371 | Female | 80 | 1 | 0 | Yes | Self-employed | Rural | 72.67 | 28.9 | never smoked | 1 |
70,676 | Female | 76 | 0 | 0 | Yes | Govt_job | Rural | 62.57 | null | formerly smoked | 1 |
2,326 | Female | 67 | 1 | 0 | Yes | Private | Rural | 179.12 | 28.1 | formerly smoked | 1 |
27,169 | Female | 66 | 1 | 0 | Yes | Govt_job | Rural | 116.55 | 31.1 | formerly smoked | 1 |
50,784 | Male | 63 | 0 | 0 | Yes | Private | Rural | 228.56 | 27.4 | never smoked | 1 |
19,773 | Female | 52 | 0 | 0 | Yes | Private | Rural | 96.59 | 26.4 | never smoked | 1 |
66,159 | Female | 80 | 0 | 1 | Yes | Self-employed | Rural | 66.72 | 21.7 | formerly smoked | 1 |
36,236 | Male | 80 | 1 | 0 | Yes | Private | Urban | 240.09 | 27 | never smoked | 1 |
71,673 | Female | 79 | 0 | 0 | Yes | Private | Urban | 110.85 | 24.1 | formerly smoked | 1 |
45,805 | Female | 51 | 0 | 0 | Yes | Private | Urban | 165.31 | null | never smoked | 1 |
42,117 | Male | 43 | 0 | 0 | Yes | Self-employed | Urban | 143.43 | 45.9 | Unknown | 1 |
57,419 | Male | 59 | 0 | 0 | Yes | Private | Rural | 96.16 | 44.1 | Unknown | 1 |
26,015 | Female | 66 | 0 | 0 | Yes | Self-employed | Urban | 101.45 | null | Unknown | 1 |
26,727 | Female | 79 | 0 | 0 | No | Private | Rural | 88.92 | 22.9 | never smoked | 1 |
66,638 | Female | 68 | 1 | 0 | No | Self-employed | Urban | 79.79 | 29.7 | never smoked | 1 |
70,042 | Male | 58 | 0 | 0 | Yes | Private | Urban | 71.2 | null | Unknown | 1 |
32,399 | Male | 54 | 0 | 0 | Yes | Private | Rural | 96.97 | 29.1 | smokes | 1 |
3,253 | Male | 61 | 0 | 1 | Yes | Private | Rural | 111.81 | 27.3 | smokes | 1 |
71,796 | Female | 70 | 0 | 1 | Yes | Private | Rural | 59.35 | 32.3 | formerly smoked | 1 |
14,499 | Male | 47 | 0 | 0 | Yes | Private | Urban | 86.94 | 41.1 | formerly smoked | 1 |
49,130 | Male | 74 | 0 | 0 | Yes | Private | Urban | 98.55 | 25.6 | Unknown | 1 |
28,291 | Female | 79 | 0 | 1 | Yes | Private | Urban | 226.98 | 29.8 | never smoked | 1 |
51,169 | Male | 81 | 0 | 0 | Yes | Private | Urban | 72.81 | 26.3 | never smoked | 1 |
66,315 | Female | 57 | 0 | 0 | No | Self-employed | Urban | 68.02 | 37.5 | never smoked | 1 |
37,726 | Female | 80 | 1 | 0 | Yes | Self-employed | Urban | 68.56 | 26.2 | Unknown | 1 |
54,385 | Male | 45 | 0 | 0 | Yes | Private | Rural | 64.14 | 29.4 | never smoked | 1 |
2,458 | Female | 78 | 0 | 0 | Yes | Private | Rural | 235.63 | 32.3 | never smoked | 1 |
35,512 | Female | 70 | 0 | 0 | Yes | Self-employed | Rural | 76.34 | 24.4 | formerly smoked | 1 |
56,841 | Male | 58 | 0 | 1 | Yes | Private | Rural | 240.59 | 31.4 | smokes | 1 |
8,154 | Male | 57 | 1 | 0 | Yes | Govt_job | Urban | 78.92 | 27.7 | formerly smoked | 1 |
4,639 | Female | 69 | 0 | 0 | Yes | Govt_job | Urban | 82.81 | 28 | never smoked | 1 |
Stroke Prediction Dataset Analysis
Presentation Video
Project Overview
The goal of this project is to predict the likelihood of a patient suffering a stroke based on demographic, health, and lifestyle parameters. Stroke is a leading cause of death and long-term disability worldwide, and early identification of high-risk individuals can significantly improve prevention strategies and clinical outcomes.
Dataset Summary
- Source: Kaggle – Stroke Prediction Dataset by fedesoriano
- Size: 5,110 rows × 12 features
- Target Variable:
- stroke → (1 = patient had a stroke, 0 = no stroke)
Key Feature Categories
numeric_columns- age - bmi - avg glucose level- stroke
categorical_columns- gender - hypertension - heart disease - ever married - work type - Residence type - smoking status
Exploratory Data Analysis & Insights
1. Data Cleaning & Handling
'id' coulm:
- The id column was dropped from the dataset.
- Reason: The id column serves only as a unique identifier for each record and does not contain any meaningful information related to stroke prediction. Including it in the analysis or model could introduce unnecessary noise without improving predictive performance.
Missing Values
- The bmi column contains 201 missing values.
- These null entries were addressed using Mean Imputation. Each missing value was filled with the average BMI calculated from the rest of the column to maintain the overall distribution of the dataset without losing significant rows of data.
Outlier Detection
- BMI:
Action: Outliers were identified but retained.
Reason: High BMI values are clinically significant and strongly associated with increased health risks, including stroke. Removing these records would result in the loss of important information about how extreme BMI values influence the target variable.
Glucose Level:
Action: Outliers were identified but retained.
Reason: Extreme glucose levels are medically relevant indicators, particularly in the context of stroke risk. Retaining these values ensures that the model captures the full spectrum of possible health conditions.
Gender Variable:
- Action:A third category, "Other," was identified in the data and removed.
- Reason:The count for this category was extremely low(only 1). Removing it simplifies the analysis without impacting the overall ability to understand the target value, given the abundance of data for "Male" and "Female."
Data Observations & Limitations
- Smoking Status:
- A large number of records are categorized as 'Unknown'.
- Note: Because of this high frequency of missing information within the category, any conclusions drawn regarding the impact of smoking status on stroke risk should be taken with a grain of salt.
2. visualizations
-percentage of patients compared to the number of percentage of healthy people:

- In the dataset of the stroke patients, the distribution was as follows:
- Healthy (no stroke): 95.1%
- Patients (stroke): 4.9%
-Correlation matrix for numerical features: -The goal is to find interesting relationships—either between the independent variables themselves or between them and the target variable
- Relationships between independent variables themselves-here is a notable correlation between age and bmi (0.33), as well as age and glucose level (0.24).
- Relationships between independent variables and the target variable: We will talk about the topic in the research question
-Initial exploration of variable distributions:
- Age: There is a presence of people of all ages, with a peak around the 50-60 age range. implies a diverse data set.
- BMI: Most of the data is concentrated between 20 and 40.There is a "long tail" extending toward the right, indicating a few individuals with very high BMI values
- Avg Glucose level: The initial, much larger peak is around 80-100, which represents the "normal" range for most people. A secondary, smaller peak appears around 200-230, presumably representing a subset of the "unhealthy" population.
- Stroke: The vast majority of the data set did not have a stroke. The small bump on the right side shows that a minority had a stroke.
3. Research Questions:
Is there a correlation between age and the prevalence of stroke?
Do BMI and average glucose levels serve as significant predictors for stroke?
Does smoking status increase the likelihood of experiencing a stroke?
Are people with heart disease and Hypertension More likely to have a stroke??
4. Answers:
Is there a correlation between age and the prevalence of stroke? Yes! -
-
-The data show a clear age difference between the groups: people who have experienced a stroke are significantly older compared to those who have not.Do BMI and average glucose levels serve as significant predictors for stroke? Partial answer -
-
- While glucose levels show a clear correlation to stroke, BMI shows a slight association, the data is inconclusive. Therefore, We cannot provide a definitive answer.Does smoking status increase the likelihood of experiencing a stroke? Partial answer -
- It is difficult to say whether smoking causes a stroke. Because we have already mentioned that a large number of people when asked about smoking gave the following answer - "unknown". Therefore, any result of this sample, we took it with a grain of salt.Are people with heart disease and Hypertension More likely to have a stroke? Yes! -
-
-The data show that hypertension and heart disease are a common cause of stroke.
5. Insights:
1. Age appears to be the main determinant of stroke risk, with older people being more likely to experience a stroke.
2. Heart disease appears as a major factor, strongly associated with a higher likelihood of stroke.
3. The presence of Hypertension is also an important risk indicator, increasing the probability of a stroke occurring.
4. High glucose levels may contribute to stroke risk, suggesting a possible link between impaired blood sugar regulation and stroke.
5. A higher BMI shows a slight association with stroke, the data is inconclusive. Therefore, We cannot provide a definitive answer.
6. No clear connection was found between smoking and stroke in this dataset. That said, with nearly 30% of the values missing, the data may not be consistent enough to draw a firm conclusion.
Overall:
Only 5% of the individuals in this dataset suffered a stroke. Due to this significant class imbalance, the insights may not represent the general population perfectly. All analyses and conclusions are strictly based on the patterns found within this specific dataset. The risk of stroke is mainly driven by a person's age and physical health. Age stands out as the most significant factor, with the risk increasing sharply as the patients get older. This is closely followed by hypertension, heart disease, and high glucose levels, all three of which act as strong predictors of stroke occurrence in this data set. It is also important to note that for some variables, such as smoking and BMI, the high amount of missing data made it difficult to draw a firm conclusion. Ultimately, the data indicate that stroke is a combined condition, where a combination of aging and poor physiological condition creates the highest level of risk.
Author
Nadav Benaiah
- Downloads last month
- 106





