{ "cells": [ { "cell_type": "markdown", "id": "worldwide-blood", "metadata": {}, "source": [ "# Introduction" ] }, { "cell_type": "markdown", "id": "understanding-numbers", "metadata": {}, "source": [ "My research will analyze a dataset to compare different lifestyle factors and their effects on sleep duration and sleep quality. I aim to determine whether self-reported factors, such as occupation and physical activity level, have a stronger influence on sleep, or if the factors that individuals have less control over, like stress level or BMI, play a larger role. Although the stress ratings in the dataset are subjective, they still provide valuable insight that can be compared across participants to understand how strongly stress and other variables impact sleep patterns." ] }, { "cell_type": "markdown", "id": "greater-circular", "metadata": {}, "source": [ "**Which lifestyle factors most strongly influence sleep quality?**" ] }, { "cell_type": "markdown", "id": "appreciated-testimony", "metadata": {}, "source": [ "I chose this topic because I’ve personally experienced some sleep issues and wanted to explore what factors might contribute to them using this specific dataset. While the results won’t be absolute and may differ with other datasets, this analysis can still help me better understand possible connections between lifestyle and sleep quality. It’s also simply a topic that interests me, and I was curious to learn more about how different habits and conditions can affect sleep." ] }, { "cell_type": "markdown", "id": "permanent-pollution", "metadata": {}, "source": [ "# Data" ] }, { "cell_type": "code", "execution_count": 53, "id": "technical-evans", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "code", "execution_count": 54, "id": "overhead-sigma", "metadata": {}, "outputs": [], "source": [ "file_name = \"Sleep_health_and_lifestyle_dataset.csv\"\n", "dataset_path = \"data/\" + file_name\n", "\n", "df = pd.read_csv(dataset_path)" ] }, { "cell_type": "code", "execution_count": 55, "id": "heated-blade", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | Person ID | \n", "Gender | \n", "Age | \n", "Occupation | \n", "Sleep Duration | \n", "Quality of Sleep | \n", "Physical Activity Level | \n", "Stress Level | \n", "BMI Category | \n", "Blood Pressure | \n", "Heart Rate | \n", "Daily Steps | \n", "Sleep Disorder | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "1 | \n", "Male | \n", "27 | \n", "Software Engineer | \n", "6.1 | \n", "6 | \n", "42 | \n", "6 | \n", "Overweight | \n", "126/83 | \n", "77 | \n", "4200 | \n", "NaN | \n", "
| 1 | \n", "2 | \n", "Male | \n", "28 | \n", "Doctor | \n", "6.2 | \n", "6 | \n", "60 | \n", "8 | \n", "Normal | \n", "125/80 | \n", "75 | \n", "10000 | \n", "NaN | \n", "
| 2 | \n", "3 | \n", "Male | \n", "28 | \n", "Doctor | \n", "6.2 | \n", "6 | \n", "60 | \n", "8 | \n", "Normal | \n", "125/80 | \n", "75 | \n", "10000 | \n", "NaN | \n", "
| 3 | \n", "4 | \n", "Male | \n", "28 | \n", "Sales Representative | \n", "5.9 | \n", "4 | \n", "30 | \n", "8 | \n", "Obese | \n", "140/90 | \n", "85 | \n", "3000 | \n", "Sleep Apnea | \n", "
| 4 | \n", "5 | \n", "Male | \n", "28 | \n", "Sales Representative | \n", "5.9 | \n", "4 | \n", "30 | \n", "8 | \n", "Obese | \n", "140/90 | \n", "85 | \n", "3000 | \n", "Sleep Apnea | \n", "