Sleep Health and Lifestyle
This synthetic dataset contains sleep and cardiovascular metrics as well as lifestyle factors of close to 400 fictive persons.
The workspace is set up with one CSV file, data.csv
, with the following columns:
Person ID
Gender
Age
Occupation
Sleep Duration
: Average number of hours of sleep per dayQuality of Sleep
: A subjective rating on a 1-10 scalePhysical Activity Level
: Average number of minutes the person engages in physical activity dailyStress Level
: A subjective rating on a 1-10 scaleBMI Category
Blood Pressure
: Indicated as systolic pressure over diastolic pressureHeart Rate
: In beats per minuteDaily Steps
Sleep Disorder
: One ofNone
,Insomnia
orSleep Apnea
Check out the guiding questions or the scenario described below to get started with this dataset! Feel free to make this workspace yours by adding and removing cells, or editing any of the existing cells.
Source: Kaggle
π Some guiding questions to help you explore this data:
- Which factors could contribute to a sleep disorder?
- Does an increased physical activity level result in a better quality of sleep?
- Does the presence of a sleep disorder affect the subjective sleep quality metric?
π Visualization ideas
- Boxplot: show the distribution of sleep duration or quality of sleep for each occupation.
- Show the link between age and sleep duration with a scatterplot. Consider including information on the sleep disorder.
π Scenario: Automatically identify potential sleep disorders
This scenario helps you develop an end-to-end project for your portfolio.
Background: You work for a health insurance company and are tasked to identify whether or not a potential client is likely to have a sleep disorder. The company wants to use this information to determine the premium they want the client to pay.
Objective: Construct a classifier to predict the presence of a sleep disorder based on the other columns in the dataset.
Check out our Linear Classifiers course (Python) or Supervised Learning course (R) for a quick introduction to building classifiers.
You can query the pre-loaded CSV files using SQL directly. Hereβs a sample query:
SELECT *
FROM 'data.csv'
LIMIT 10
import pandas as pd
sleep_data = pd.read_csv('data.csv')
sleep_data.head()
Map to the Eiffel Tower
To create a map pointing to the Eiffel Tower, you can use the folium
library in Python. Here's an example code snippet:
import folium # Create a map centered at the Eiffel Tower map_eiffel = folium.Map(location=[48.8584, 2.2945], zoom_start=15) # Add a marker at the Eiffel Tower folium.Marker(location=[48.8584, 2.2945], popup='Eiffel Tower').add_to(map_eiffel) # Display the map map_eiffel
This code will create a map centered at the coordinates of the Eiffel Tower (latitude: 48.8584, longitude: 2.2945) and add a marker at that location. You can customize the zoom level and popup message as needed.
Map to My Current Location
To create a map pointing to your current location, you can use the folium
library in Python. Here's an example code snippet:
import folium # Get the latitude and longitude of your current location latitude = ... longitude = ... # Create a map centered at your current location map_current = folium.Map(location=[latitude, longitude], zoom_start=15) # Add a marker at your current location folium.Marker(location=[latitude, longitude], popup='My Current Location').add_to(map_current) # Display the map map_current
This code will create a map centered at the coordinates of your current location and add a marker at that location. You can customize the zoom level and popup message as needed.
Ready to share your work?
Click "Share" in the upper right corner, copy the link, and share it! You can also easily add this workspace to your DataCamp Portfolio.