SleepInc: Helping you find better sleep ๐ด
๐ Background
Your client is SleepInc, a sleep health company that recently launched a sleep-tracking app called SleepScope. The app monitors sleep patterns and collects users' self-reported data on lifestyle habits. SleepInc wants to identify lifestyle, health, and demographic factors that strongly correlate with poor sleep quality. They need your help to produce visualizations and a summary of findings for their next board meeting! They need these to be easily digestible for a non-technical audience!
๐พ The data
SleepInc has provided you with an anonymized dataset of sleep and lifestyle metrics for 374 individuals. This dataset contains average values for each person calculated over the past six months.
The dataset includes 13 columns covering sleep duration, quality, disorders, exercise, stress, diet, demographics, and other factors related to sleep health.
| Column | Description |
|---|---|
Person ID | An identifier for each individual. |
Gender | The gender of the person (Male/Female). |
Age | The age of the person in years. |
Occupation | The occupation or profession of the person. |
Sleep Duration (hours) | The average number of hours the person sleeps per day. |
Quality of Sleep (scale: 1-10) | A subjective rating of the quality of sleep, ranging from 1 to 10. |
Physical Activity Level (minutes/day) | The average number of minutes the person engages in physical activity daily. |
Stress Level (scale: 1-10) | A subjective rating of the stress level experienced by the person, ranging from 1 to 10. |
BMI Category | The BMI category of the person (e.g., Underweight, Normal, Overweight). |
Blood Pressure (systolic/diastolic) | The average blood pressure measurement of the person, indicated as systolic pressure over diastolic pressure. |
Heart Rate (bpm) | The average resting heart rate of the person in beats per minute. |
Daily Steps | The average number of steps the person takes per day. |
Sleep Disorder | The presence or absence of a sleep disorder in the person (None, Insomnia, Sleep Apnea). |
Acknowledgments: Laksika Tharmalingam, Kaggle: https://www.kaggle.com/datasets/uom190346a/sleep-health-and-lifestyle-dataset (this is a fictitious dataset)
import pandas as pd
raw_data = pd.read_csv('sleep_health_data.csv')
raw_data๐ช Challenge
Leverage this sleep data to analyze the relationship between lifestyle, health, demographic factors, and sleep quality. Your goal is to identify factors that correlate with poor sleep health.
Some examples:
- Examine relationships between several factors like gender, occupation, physical activity, stress levels, and sleep quality/duration. Create visualizations to present your findings.
- Produce recommendations on ways people can improve sleep health based on the patterns in the data.
- Develop an accessible summary of study findings and recommendations for improving sleep health for non-technical audiences.
โ
Checklist before publishing into the competition
- Rename your workspace to make it descriptive of your work. N.B. you should leave the notebook name as notebook.ipynb.
- Remove redundant cells like the judging criteria, so the workbook is focused on your story.
- Make sure the workbook reads well and explains how you found your insights.
- Try to include an executive summary of your recommendations at the beginning.
- Check that all the cells run without error.
Executive Summary
- Improving both sleep quality and duration is SleepInc's core mission. We've recently launched SleepScope, letting us track sleep patterns and collect user's self-reproted data on lifestyle habits.*
- Recent feedback has revolved around how can SleepScope improve sleep quality. Here are our conclusions and next steps for our product:
- Customers would be better of by working out but just walking 30+ minutes a day won't do it; users need to engage in 60+ minutes of physical activity every day. SleepInc could think of associating with Gyms or or similar companies to provide their customers special deals. Special consideration/pilot programs could start with Obese people, as they report sleeping almost one hour less every day, with much lower quality than non-obese people
- Managing stress is hey to improve sleep quality and duration, as it increases heart rate key driver of sleep quality/duration. We could do the following: i) Create an automatic alarm to alert users whenever 70 bpm are reached/surpassed; ii) Partner with mindfulness companies (e.g. Headspace) to provide deals to our customers. A special program could be done for stressful occupations such as doctors, since they are more prone to sleep less and poorly, because of high stress.
- Controlling/treating sleep disorders is key, particularly insomnia. We could track daily sleep patterns and, when note consistent lack of sleep, advice customers to go to the doctor as they could have insomnia. Sleep insomnia doesnt' seem like a big deal but we could think of tracking it in the future as long-term effects on overall health and sleep quality/duration are known.
IMPORTS
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as snsLoad and get to know our data source
# Load the data
sleep = pd.read_csv('sleep_health_data.csv')
# Check for null
sleep.isna().any() ## There's no missing data
# Check for duplicated info
sleep.duplicated().sum() ## There's no duplicated info
# Know our varible types and distribution
sleep.describe()#sns.pairplot(data=sleep)Preliminary data analysis: Some conclusions about sleep quantity and quality (numeric variables only):
- There seems to be a positive relationship between phisical activity and both sleep quality and duration
- There seems to be a negative relationship between stress level and both sleep quality and duration: worth reviewing what causes stress.
- There seems to be a negative relationship between heart rate and both sleep quality and duration. This can be a consequence of higher stress levels (there seems to be a correlation between them), among other causes.
- There seems to be a positive relationship between age and sleep. This one is wierd as generally, older people tend to have more problems sleeping. We should deep dive into this.
Preliminary data analysis: Some conclusions about sleep quantity and quality (non-numeric variables only):
- Does gender has an incidence on sleep quality and/or duration?
- occupation as stress source?
- BMI category to support physical activity (maybe overwight people sleep poorly and also don't do much physical act.)
- BMI category has incidence in some other diseases/disorders (e.g. Apnea, higher pressure, etc.)
Gender
โ
โ