Dataset Viewer
Auto-converted to Parquet Duplicate
ID
int64
Age
int64
Gender
string
Country
string
Coffee_Intake
float64
Caffeine_mg
float64
Sleep_Hours
float64
Sleep_Quality
string
BMI
float64
Heart_Rate
int64
Stress_Level
string
Physical_Activity_Hours
float64
Health_Issues
string
Occupation
string
Smoking
int64
Alcohol_Consumption
int64
1
40
Male
Germany
3.5
328.1
7.5
Good
24.9
78
Low
14.5
null
Other
0
0
2
33
Male
Germany
1
94.1
6.2
Good
20
67
Low
11
null
Service
0
0
3
42
Male
Brazil
5.3
503.7
5.9
Fair
22.7
59
Medium
11.2
Mild
Office
0
0
4
53
Male
Germany
2.6
249.2
7.3
Good
24.7
71
Low
6.6
Mild
Other
0
0
5
32
Female
Spain
3.1
298
5.3
Fair
24.1
76
Medium
8.5
Mild
Student
0
1
6
32
Male
Mexico
3.4
326.4
6.4
Good
27
82
Low
8.8
null
Service
0
0
7
53
Male
France
2.7
252.1
7.8
Good
24.3
58
Low
1
Mild
Student
1
0
8
44
Female
Canada
4.5
423.5
5.5
Fair
15.8
62
Medium
0.7
Mild
Service
1
1
9
29
Male
UK
1.7
162
7.1
Good
21.7
60
Low
2.2
null
Service
1
1
10
41
Female
Switzerland
4
383.2
6.4
Good
30.4
69
Low
11.9
Mild
Office
0
0
11
29
Female
Switzerland
4.5
427.5
8.1
Excellent
21.5
66
Low
8.4
null
Other
0
1
12
29
Male
Netherlands
4.1
385.2
6.5
Good
23.1
80
Low
8.9
null
Office
0
1
13
37
Female
Italy
4.7
441.9
6.9
Good
15.4
77
Low
5.2
null
Service
0
1
14
18
Female
Italy
1.4
133.4
6.6
Good
19.8
78
Low
13
null
Office
0
0
15
18
Male
Mexico
3.2
308.3
5.9
Fair
21.1
83
Medium
14.5
Mild
Service
1
0
16
28
Male
Spain
3.1
297
6.8
Good
31.7
56
Low
3.2
Mild
Office
0
0
17
22
Female
China
2.6
248.2
5.9
Fair
24
70
Medium
4.7
Mild
Service
1
0
18
38
Female
Japan
3.4
326.8
7.7
Good
23.3
72
Low
4.9
null
Healthcare
1
1
19
24
Female
UK
4.3
409.5
7.8
Good
22.7
63
Low
14.4
null
Healthcare
0
1
20
18
Male
Germany
1.4
134.6
6.9
Good
18.8
70
Low
7.8
null
Student
0
0
21
52
Female
Italy
0.7
65.5
6.4
Good
28.2
74
Low
8.5
Mild
Service
0
0
22
32
Male
France
2.2
208.3
6.9
Good
17
65
Low
5.5
null
Office
0
0
23
35
Female
Belgium
0
0
5.5
Fair
23.4
70
Medium
13.5
Mild
Service
0
0
24
18
Female
UK
2.4
227.6
5.7
Fair
15.4
67
Medium
2.9
Mild
Office
0
0
25
28
Female
Finland
4.6
441.2
5
Poor
21.6
78
High
6.9
Mild
Student
0
0
26
36
Female
Mexico
0.4
34.7
6.1
Good
15
79
Low
3.4
null
Service
1
0
27
21
Female
Belgium
1.9
178
6
Fair
20.8
76
Medium
8.8
Mild
Student
0
0
28
39
Female
Australia
0.8
75.5
5.3
Fair
27.6
85
Medium
8.2
Mild
Office
0
0
29
27
Male
Canada
3.1
294
6.2
Good
18.1
50
Low
2
null
Other
0
1
30
31
Female
Australia
3.5
328.2
6.2
Good
21.6
67
Low
12.5
null
Office
0
1
31
27
Female
USA
2.5
240.6
7.3
Good
27.5
59
Low
1.8
null
Student
0
0
32
57
Male
Finland
1.5
139.9
6.9
Good
32.7
86
Low
2.6
Moderate
Service
1
0
33
34
Male
France
2.8
264.6
8.3
Excellent
24.9
58
Low
4.1
null
Service
0
0
34
22
Male
Sweden
4.4
413.8
7.1
Good
22.1
86
Low
12.2
null
Student
0
0
35
44
Female
Brazil
3.8
364.3
9.2
Excellent
22.7
68
Low
3.1
null
Service
0
0
36
20
Female
China
1.9
179.5
5.3
Fair
21.2
63
Medium
3.3
Mild
Healthcare
0
0
37
37
Male
Italy
2
191.3
7.9
Good
23.1
73
Low
9.8
null
Other
0
0
38
18
Female
China
2
187.4
4.8
Poor
35.8
90
High
12.4
Moderate
Student
0
1
39
19
Male
China
3.2
307.4
7.8
Good
27.8
62
Low
10.5
null
Other
0
0
40
37
Female
India
0.4
40.6
7.4
Good
26.4
72
Low
8.1
null
Student
1
0
41
43
Male
Norway
3.3
314.8
6.2
Good
25.4
75
Low
9.8
null
Other
1
1
42
37
Male
USA
1.7
160.3
7
Good
24.4
60
Low
8.2
null
Office
0
0
43
33
Male
Norway
2.1
199.7
6.1
Good
24.5
64
Low
5.4
null
Student
1
0
44
31
Male
Finland
1.4
133.4
6.1
Good
30.5
65
Low
10.4
Mild
Service
1
0
45
18
Female
Italy
3.6
341.7
7
Good
24.6
72
Low
10.3
null
Other
1
0
46
26
Female
Canada
1.6
153
4.8
Poor
23.1
56
High
9.5
Mild
Office
0
0
47
29
Male
UK
1.1
100.8
7.2
Good
19.8
70
Low
9.5
null
Office
0
0
48
47
Male
India
1.6
155
6.6
Good
24.6
59
Low
3.5
null
Office
0
0
49
39
Male
China
0.9
83.3
6.5
Good
21.6
68
Low
13.9
null
Service
0
1
50
18
Female
Belgium
3.8
360.3
5.8
Fair
23.3
60
Medium
14.9
Mild
Office
0
0
51
38
Female
Netherlands
0.8
80.4
7.2
Good
20.2
83
Low
8.3
null
Other
1
1
52
30
Male
Japan
2.4
231.3
7.9
Good
24.3
73
Low
3.4
null
Service
0
0
53
26
Female
China
1.5
144.8
9.4
Excellent
21.4
62
Low
4.8
null
Student
0
0
54
42
Male
Finland
4.9
461
7.6
Good
18.9
89
Low
11.1
null
Service
0
0
55
47
Female
France
3.1
297.8
7.5
Good
29
56
Low
4.1
null
Student
1
0
56
46
Female
India
1.6
147.8
5.8
Fair
18.2
70
Medium
9.1
Mild
Student
0
0
57
24
Female
Spain
2.8
261.9
5.9
Fair
20.9
75
Medium
1.5
Mild
Student
0
1
58
31
Female
India
1.1
107.9
6.8
Good
25.5
67
Low
14.5
null
Student
0
1
59
38
Female
Sweden
3.5
333.2
7
Good
28
70
Low
12.6
null
Service
0
1
60
46
Female
Japan
2.8
261.4
6
Good
23.9
64
Low
12.3
null
Healthcare
1
0
61
29
Female
Spain
3.1
297.2
8
Good
23.5
62
Low
11.6
null
Healthcare
0
0
62
32
Male
Japan
1.1
101.6
6
Good
18.8
79
Low
0
null
Office
0
1
63
21
Male
Finland
0.4
40.3
5.4
Fair
21.2
71
Medium
1
Mild
Other
0
0
64
20
Male
Japan
0
0.4
8.2
Excellent
17.2
73
Low
8.8
null
Other
0
0
65
44
Female
Netherlands
0.1
11.2
7.3
Good
23.3
76
Low
11.5
null
Other
0
1
66
51
Male
Sweden
2.5
239.1
6.3
Good
25.9
64
Low
11.3
Mild
Office
1
0
67
34
Male
Mexico
5.4
511.4
4.5
Poor
25.6
65
High
7.9
Mild
Other
0
1
68
47
Male
Belgium
1.9
180.6
7.9
Good
16.9
63
Low
7.8
null
Service
0
1
69
39
Male
Canada
1.6
155
9.6
Excellent
26.5
71
Low
1.3
null
Healthcare
0
0
70
27
Female
Italy
2.4
229.8
7.2
Good
29.2
90
Low
13.9
null
Student
0
0
71
39
Female
Brazil
1.3
125.5
6
Good
22.5
71
Low
4.7
null
Other
0
0
72
53
Female
Australia
0.6
54.8
7.2
Good
30.3
50
Low
3.1
Moderate
Office
0
0
73
34
Female
Mexico
1.5
144.2
7.4
Good
22.2
73
Low
9
null
Office
0
0
74
53
Female
Germany
2.2
205.2
7.3
Good
17.8
74
Low
0.4
Mild
Service
0
1
75
18
Male
Finland
5.3
502.5
5.2
Fair
23.4
82
Medium
14.4
Mild
Student
1
0
76
44
Male
Japan
1.8
167.9
6.1
Good
22.8
83
Low
5.5
null
Student
0
1
77
36
Female
Australia
2.8
265.3
5.7
Fair
28.2
100
Medium
4.4
Mild
Office
1
0
78
31
Male
UK
0.4
42
7.4
Good
20
69
Low
2.3
null
Other
0
0
79
36
Male
UK
3.5
336.4
6.4
Good
25.6
74
Low
7.6
null
Service
0
1
80
18
Female
Australia
1.4
132.1
8.2
Excellent
17.1
74
Low
5.8
null
Service
1
0
81
32
Male
Sweden
0.8
76.6
7.2
Good
21.8
66
Low
4.6
null
Student
0
0
82
39
Male
Australia
1
91
7.7
Good
22.5
68
Low
2
null
Service
0
0
83
52
Male
Australia
1.5
146
6.4
Good
22
63
Low
4.9
Mild
Healthcare
0
0
84
28
Male
Spain
0.8
72.8
4.7
Poor
17.7
66
High
12.3
Mild
Student
0
1
85
25
Male
Canada
2.9
279
8.2
Excellent
21.8
70
Low
11.9
null
Office
0
0
86
28
Male
Brazil
0.9
83
7
Good
24.1
75
Low
8.6
null
Service
1
0
87
45
Female
Spain
3.5
329.5
7
Good
28.3
75
Low
11.3
null
Student
0
0
88
38
Female
Netherlands
1.7
165
7.7
Good
20.9
59
Low
9.2
null
Other
0
0
89
28
Male
Canada
1.1
106.8
7.1
Good
19.9
57
Low
1.7
null
Other
0
1
90
41
Female
Italy
1.5
140.1
4.6
Poor
33.1
65
High
13.9
Moderate
Healthcare
1
0
91
36
Male
Italy
1
92.8
6.4
Good
15.5
86
Low
7.5
null
Office
0
0
92
46
Male
Norway
2.5
240.6
6
Good
20.9
75
Low
11.1
null
Other
0
0
93
26
Male
Germany
1.7
159.8
6.2
Good
19.8
72
Low
13.1
null
Student
1
0
94
31
Female
South Korea
4.2
395.9
6.1
Good
17.3
79
Low
13.2
null
Service
0
0
95
30
Male
Italy
0
0
7.1
Good
23.6
57
Low
14
null
Other
0
0
96
18
Female
France
4.3
404
8.7
Excellent
28.4
79
Low
9.7
null
Other
0
0
97
38
Female
Netherlands
1.5
141.6
7.4
Good
28.2
64
Low
9.5
null
Healthcare
0
0
98
38
Female
France
4.9
465.6
7.1
Good
26.3
56
Low
3.6
null
Service
0
0
99
35
Female
Sweden
2.7
254.7
6
Good
28.8
69
Low
4.7
null
Service
0
0
100
32
Female
UK
4.3
408.5
8.1
Excellent
23
82
Low
9.1
null
Other
0
1
End of preview. Expand in Data Studio

Coffee Intake & General Health — Exploratory Data Analysis (EDA)

The Video

1. Objective

This project investigates whether a relationship exists between coffee intake levels and key health indicators — sleep, BMI, heart rate, and stress — using a 10,000-person synthetic health dataset sourced from Kaggle. The analysis follows a structured EDA pipeline: cleaning, transformation, segmentation, visualization, and correlation testing.


2. Dataset Overview

The dataset contains individual-level health and lifestyle measurements used to explore the relationship between coffee consumption and general health outcomes.

  • Raw size: 10,000 rows × 16 features
  • Clean size: ~9,400 rows × 15 features (after filtering + column removal)

Feature Categories

Feature Type Description
Age Numeric Age of the individual
Gender Categorical Male / Female
Country Categorical Country of origin
Coffee_Intake Numeric Daily coffee consumption (cups/day)
Caffeine_mg Numeric Estimated daily caffeine intake (mg)
Sleep_Hours Numeric Average nightly sleep duration
Sleep_Quality Categorical Self-reported sleep quality
BMI Numeric Body Mass Index
Heart_Rate Numeric Resting heart rate (BPM)
Stress_Level Categorical Self-reported stress level (Low / Medium / High)
Physical_Activity_Hours Numeric Weekly physical activity hours
Occupation Categorical Occupation category
Smoking Numeric Smoking indicator
Alcohol_Consumption Numeric Alcohol consumption level
Coffee_Drinker_Type Categorical Engineered group: Low / Moderate / High (quantile-based)

Target Variable

Coffee intake group — an engineered categorical variable created by splitting the continuous Coffee_Intake column into three quantile-based groups of roghly equal size:

  • Low — bottom third of daily intake
  • Moderate — middle third
  • High — top third

This variable is used throughout as the primary grouping factor for health comparison.


3. Methodology

3.1 Data Cleaning

Column Removal

The Health_Issues column was removed from the dataset. Upon review, it was found to be inconsistently populated and lacked a clear, reliable definition compared to the other health metrics available. Removing it preserved data integrity without meaningful information loss.

Invalid Value Filtering

Exploratory checks using df.describe() revealed that Sleep_Hours contained values as low as 3 hours per night. This was identified as implausible for a population-level health dataset and inconsistent with human physiology.

Decision: All rows where Sleep_Hours < 5 were removed.

before = len(df)
df = df[df['Sleep_Hours'] >= 5].reset_index(drop=True)
after = len(df)
print(f"Removed {before - after} rows with Sleep_Hours < 5")

This filtering was applied before re-engineering the Coffee_Drinker_Type groups to ensure the group boundaries reflected the cleaned population, not the raw one.

Duplicate Check

print(df.duplicated().sum())  # → 0

No duplicate rows were found.

3.2 Feature Engineering

Coffee_Drinker_Type was created using quantile-based binning (pd.qcut, q=3), which ensures equal sample sizes across groups and makes group comparisons statistically fair. Equal-width binning was evaluated but rejected because coffee intake is right-skewed — equal-width bins would have produced very uneven groups.

df['Coffee_Drinker_Type'] = pd.qcut(
    df['Coffee_Intake'], q=3, labels=['Low', 'Moderate', 'High']
)

3.3 Group Distribution

After cleaning and re-binning, the three groups are near-equal in size, confirming the quantile approach worked as intended.

image


4. Exploratory Data Analysis (EDA)

Research Question

Is there a measurable relationship between high coffee intake and general health outcomes?


Research Question 1

Does coffee intake level affect sleep duration?

Observation:

  • A clear downward trend is visible across groups: Low intake has the highest median sleep hours, High intake has the lowest.
  • The overlap between groups is present, indicating that coffee is one of several factors — not the only driver of sleep duration.

Correlation Analysis:

To move beyond group comparison and test whether the relationship holds continuously, a Pearson correlation and regression analysis was run directly on the raw Coffee_Intake variable:

image

Statistical Result:

Metric Value
Pearson r −0.17
Direction Negative
Strength Weak
p-value < 0.001

Insight: The negative correlation (r = −0.17, p < 0.001) is statistically significant and consistent across all three intake groups. Higher coffee consumption is weakly associated with reduced sleep duration. The relationship is real but modest — coffee intake is one contributor among several factors affecting sleep.

Conclusion: Coffee intake has a weak but statistically significant negative association with sleep hours. It is the clearest directional signal in the dataset.


Research Question 2

Is BMI associated with coffee intake level?

Observation:

  • The boxplots show nearly identical medians and IQRs across all three groups — the distributions are visually almost indistinguishable.
  • Outliers appear equally across all three groups, consistent with a real-world population.
  • Unlike sleep, there is no visible directional shift in BMI from Low → High intake.

image

Insight: The three groups show virtually no difference in BMI distribution. This is a meaningful null finding — it suggests that coffee intake, at least in this dataset, does not meaningfully track with body weight. BMI is driven by many lifestyle variables that are not captured here.

Conclusion: BMI shows no meaningful association with coffee intake level. This variable does not carry a useful signal for the research question.


Research Question 3

Does coffee intake affect resting heart rate?

Observation:

  • The violin plots reveal that the distribution of resting heart rate shifts rightward as coffee intake increases.
  • The Low intake group is more tightly centered around a lower BPM, while the High intake group shows both a higher center and a wider spread.
  • The violin shape for the High group suggests greater variability — some individuals are unaffected while others show notable elevation.

image

Insight: The High intake group shows a measurable upward shift in resting heart rate, consistent with caffeine's known stimulant effect. The widening of the distribution in the High group is analytically interesting — it may reflect individual differences in caffeine sensitivity or confounding lifestyle variables.

Conclusion: Coffee intake is associated with modestly elevated resting heart rate. The effect is visible in distribution shape rather than median alone, which is why a violin plot was chosen over a boxplot for this metric.


Research Question 4

Does coffee intake influence stress level distribution?

Observation:

  • The bar chart shows that the vast majority of respondents in all groups report Low stress (70–82%), with Medium stress accounting for 18–29%.
  • High stress is reported by very few respondents overall: 0.5% (Low), 0.7% (Moderate), and 1.1% (High intake).
  • Despite the small absolute numbers, the directional pattern is consistent — as coffee intake increases, the Low-stress share shrinks (81.8% → 70.3%) and the High-stress share grows (0.5% → 1.1%).

image

Insight: The stress composition shift from Low → High intake is consistent and directional. Whether this reflects a causal relationship (caffeine increasing stress) or a selection effect (already-stressed individuals consuming more coffee) cannot be determined from observational data alone. Both are plausible mechanisms.

Conclusion: Coffee intake is associated with a higher proportion of high-stress reporters and a lower proportion of low-stress reporters. This is one of the most visually clear findings in the dataset.


Research Question 5

In a focused investigation into reports of high stress levels, are there any clear signs of a connection between group affiliation and age group on the number of people reporting high stress levels?(a deep dive into high stress reporters)

Observation:

  • Absolute counts of high-stress reporters: Low intake n=16 (0.5% of group), Moderate n=20 (0.7%), High n=31 (1.1%).
  • Although the absolute numbers are small, the High intake group has nearly double the rate of high-stress reporters compared to the Low group.
  • The age distributions across all three groups are broadly similar, with median ages in the low-to-mid 30s and comparable spreads.

image

Insight: The high-stress signal in the High intake group is not concentrated in a specific age bracket — it is distributed across the full age range. This makes it less likely to be a confound driven purely by age and more consistent with a genuine relationship between intake level and reported stress.

Conclusion: High-intake coffee drinkers are overrepresented among high-stress reporters across all age groups, strengthening the stress finding from Research Question 4.


Research Question 6

Within the high-stress group, is there a relationship between coffee intake and age?

Observation:

  • The scatter plot of coffee intake vs. age within the high-stress group shows a very slight positive trend.

Research Question 6

What has a bigger effect on high stress — age or coffee intake?

Observation:

  • The chart directly compares the absolute correlation strength of Age (r = 0.008) and Coffee Intake (r = 0.041) with high-stress reporting within the high-stress group.
  • Coffee Intake is roughly 5× stronger than Age as a predictor of high-stress status.
  • Both effects are small in absolute terms, but the comparison clearly identifies coffee intake as the dominant factor between the two.

image

Statistical Result:

Metric Value
Age effect (absolute r) 0.008
Coffee Intake effect (absolute r) 0.041
Dominant factor Coffee Intake (5× stronger than Age)

Insight: Age contributes virtually no signal (r = 0.008) while coffee intake, though still weak in absolute terms (r = 0.041), is meaningfully larger by comparison. This rules out age as a confounding explanation for the stress pattern observed across coffee groups.

Decision: Age is not a meaningful confound. The stress finding is attributed to coffee intake level, not to demographic age differences between groups.

Conclusion: Coffee intake is a stronger predictor of high-stress reporting than age within this group. Age can be safely excluded as an alternative explanation for the stress findings.


5. Correlation Structure

Variable Correlation with Coffee_Intake Direction
Sleep_Hours −0.17 Negative (weak)
Heart_Rate ~+0.18 Positive (weak)
BMI ~+0.02 Negligible
Stress_Score ~+0.04 Negligible
Age ~+0.008 Negligible

Key finding: Sleep and heart rate are the two variables most associated with coffee intake in this dataset. BMI, stress score, and age show negligible linear correlations.


6. Final Conclusion

This analysis shows that high coffee intake is associated with a consistent directional pattern across health indicators: less sleep, modestly elevated heart rate, and a higher share of high-stress reporters. The effect is clearest for sleep (r = −0.17, p < 0.001) and heart rate, while BMI shows no meaningful association.

No single metric shows a dramatic signal, but the directional consistency across independent outcomes — sleep, heart rate, and stress all pointing the same way — is the most meaningful finding in the dataset.

Key Takeaways

Health Metric Finding Signal Strength
Sleep Hours Negative association — High group sleeps less per night Weak (r = −0.17)
Heart Rate Positive association — High group shows elevated BPM Weak
BMI No meaningful difference across groups Negligible
Stress Level High group has highest share of high-stress reporters Small but consistent
Age No meaningful relationship with intake level Negligible

7. Limitations

  • The dataset is synthetic — relationships are plausible but may not reflect real-world causal mechanisms.
  • The analysis is observational — no causal claims can be made. Directionality (does coffee cause poor sleep, or do poor sleepers drink more coffee?) cannot be determined here.
  • Coffee_Drinker_Type groups are constructed from quantile splits; different binning schemes may shift group boundaries slightly.
  • Self-reported variables (Stress_Level, Sleep_Quality) are subject to measurement noise.
  • Confounders such as occupation, smoking, and alcohol consumption were not controlled for in the univariate analyses presented here.

8. Notebook & Plots

Full analysis with code: Google Colab Notebook

Downloads last month
6