JupyterLabDatas/week2_analysis.ipynb

252 lines
12 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"cells": [
{
"metadata": {},
"cell_type": "markdown",
"source": "# Анализ набора данных \"Мониторинга стресса студентов\"",
"id": "96a9a49f6806dfd5"
},
{
"metadata": {},
"cell_type": "markdown",
"source": [
"### Краткое описание:\n",
"В этом наборе данных исследуются основные причины стресса среди учащихся, полученные на основе общенационального опроса. Он включает около 20 ключевых характеристик, сгруппированных по пяти научно определенным категориям:\n",
"- Психологические факторы\n",
" - `уровень тревожности`\n",
" - `самоуважение`\n",
" - `депрессия, связанная с психическим здоровьем и историей болезни`\n",
"- Физиологические факторы\n",
" - `головная боль`\n",
" - `кровяное давление`\n",
" - `качество сна`\n",
" - `проблемы с дыханием`\n",
"- Факторы окружающей среды\n",
" - `уровень шума`\n",
" - `жизненные условия`\n",
" - `безопасность`\n",
" - `основные потребности`\n",
"- Академические факторы\n",
" - `академическая успеваемость`\n",
" - `учебная нагрузка`\n",
" - `отношения с преподавателями и студентами`\n",
" - `будущая карьера`\n",
"- Социальные факторы\n",
" - `социальная поддержка`\n",
" - `психологическое давление`\n",
" - `внеклассные занятия`\n",
" - `буллинг`"
],
"id": "3f7e996390db0d52"
},
{
"metadata": {},
"cell_type": "markdown",
"source": "## 1. Загрузка данных",
"id": "e82ea23923c1c1bd"
},
{
"cell_type": "code",
"id": "initial_id",
"metadata": {
"collapsed": true,
"ExecuteTime": {
"end_time": "2026-04-19T12:41:22.373444800Z",
"start_time": "2026-04-19T12:41:22.281455400Z"
}
},
"source": [
"import pandas as pd\n",
"\n",
"df = pd.read_csv(\"datas/Stress_Dataset.csv\")\n",
"df2 = pd.read_csv(\"datas/StressLevelDataset.csv\")\n",
"print(\"Загружено данных:\")\n",
"print(f'- StressLevelDataset: {df.shape[0]} строк, {df.shape[1]} столбцов')\n",
"print(f'- StressDataset: {df2.shape[0]} строк, {df2.shape[1]} столбцов')"
],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Загружено данных:\n",
"- StressLevelDataset: 843 строк, 26 столбцов\n",
"- StressDataset: 1100 строк, 21 столбцов\n"
]
}
],
"execution_count": 22
},
{
"metadata": {},
"cell_type": "markdown",
"source": "## 2. Базовый анализ",
"id": "720874a9593f504f"
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2026-04-19T12:41:22.761903800Z",
"start_time": "2026-04-19T12:41:22.423624400Z"
}
},
"cell_type": "code",
"source": [
"print(\"Базовый анализ Stress Dataset:\\n\")\n",
"df.info()\n",
"df.describe()\n",
"print(\"\\nРаспределение по гендеру и средний возраст:\")\n",
"print(df['Gender'].value_counts())\n",
"print(f\"\\n- Средний возраст парней: {df[df['Gender'] == 0]['Age'].mean()}\")\n",
"print(f\"- Средний возраст девушек: {df[df['Gender'] == 1]['Age'].mean()}\")\n",
"\n",
"print(\"\\nБазовый анализ StressLevelDataset:\\n\")\n",
"df2.info()\n",
"df2.describe()\n",
"print('\\nРаспределение по уровню стресса:')\n",
"print(df2['stress_level'].value_counts())"
],
"id": "516dfa5d689cfc2c",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Базовый анализ Stress Dataset:\n",
"\n",
"<class 'pandas.DataFrame'>\n",
"RangeIndex: 843 entries, 0 to 842\n",
"Data columns (total 26 columns):\n",
" # Column Non-Null Count Dtype\n",
"--- ------ -------------- -----\n",
" 0 Gender 843 non-null int64\n",
" 1 Age 843 non-null int64\n",
" 2 Have you recently experienced stress in your life? 843 non-null int64\n",
" 3 Have you noticed a rapid heartbeat or palpitations? 843 non-null int64\n",
" 4 Have you been dealing with anxiety or tension recently? 843 non-null int64\n",
" 5 Do you face any sleep problems or difficulties falling asleep? 843 non-null int64\n",
" 6 Have you been dealing with anxiety or tension recently?.1 843 non-null int64\n",
" 7 Have you been getting headaches more often than usual? 843 non-null int64\n",
" 8 Do you get irritated easily? 843 non-null int64\n",
" 9 Do you have trouble concentrating on your academic tasks? 843 non-null int64\n",
" 10 Have you been feeling sadness or low mood? 843 non-null int64\n",
" 11 Have you been experiencing any illness or health issues? 843 non-null int64\n",
" 12 Do you often feel lonely or isolated? 843 non-null int64\n",
" 13 Do you feel overwhelmed with your academic workload? 843 non-null int64\n",
" 14 Are you in competition with your peers, and does it affect you? 843 non-null int64\n",
" 15 Do you find that your relationship often causes you stress? 843 non-null int64\n",
" 16 Are you facing any difficulties with your professors or instructors? 843 non-null int64\n",
" 17 Is your working environment unpleasant or stressful? 843 non-null int64\n",
" 18 Do you struggle to find time for relaxation and leisure activities? 843 non-null int64\n",
" 19 Is your hostel or home environment causing you difficulties? 843 non-null int64\n",
" 20 Do you lack confidence in your academic performance? 843 non-null int64\n",
" 21 Do you lack confidence in your choice of academic subjects? 843 non-null int64\n",
" 22 Academic and extracurricular activities conflicting for you? 843 non-null int64\n",
" 23 Do you attend classes regularly? 843 non-null int64\n",
" 24 Have you gained/lost weight? 843 non-null int64\n",
" 25 Which type of stress do you primarily experience? 843 non-null str \n",
"dtypes: int64(25), str(1)\n",
"memory usage: 171.4 KB\n",
"\n",
"Распределение по гендеру и средний возраст:\n",
"Gender\n",
"0 548\n",
"1 295\n",
"Name: count, dtype: int64\n",
"\n",
"- Средний возраст парней: 20.07846715328467\n",
"- Средний возраст девушек: 20.057627118644067\n",
"\n",
"Базовый анализ StressLevelDataset:\n",
"\n",
"<class 'pandas.DataFrame'>\n",
"RangeIndex: 1100 entries, 0 to 1099\n",
"Data columns (total 21 columns):\n",
" # Column Non-Null Count Dtype\n",
"--- ------ -------------- -----\n",
" 0 anxiety_level 1100 non-null int64\n",
" 1 self_esteem 1100 non-null int64\n",
" 2 mental_health_history 1100 non-null int64\n",
" 3 depression 1100 non-null int64\n",
" 4 headache 1100 non-null int64\n",
" 5 blood_pressure 1100 non-null int64\n",
" 6 sleep_quality 1100 non-null int64\n",
" 7 breathing_problem 1100 non-null int64\n",
" 8 noise_level 1100 non-null int64\n",
" 9 living_conditions 1100 non-null int64\n",
" 10 safety 1100 non-null int64\n",
" 11 basic_needs 1100 non-null int64\n",
" 12 academic_performance 1100 non-null int64\n",
" 13 study_load 1100 non-null int64\n",
" 14 teacher_student_relationship 1100 non-null int64\n",
" 15 future_career_concerns 1100 non-null int64\n",
" 16 social_support 1100 non-null int64\n",
" 17 peer_pressure 1100 non-null int64\n",
" 18 extracurricular_activities 1100 non-null int64\n",
" 19 bullying 1100 non-null int64\n",
" 20 stress_level 1100 non-null int64\n",
"dtypes: int64(21)\n",
"memory usage: 180.6 KB\n",
"\n",
"Распределение по уровню стресса:\n",
"stress_level\n",
"0 373\n",
"2 369\n",
"1 358\n",
"Name: count, dtype: int64\n"
]
}
],
"execution_count": 23
},
{
"metadata": {},
"cell_type": "markdown",
"source": [
"### Вывод по базовому анализу\n",
"1. В исследовании участвовало: Парней: 548, Девушек: 295\n",
"2. Средний возраст обоих полов: 20 лет\n",
"3. По уровню стресса: 0: 373 (Нет стресса), 1: 358 (Небольшой стресс), 2: 369 (Сильный стресс)"
],
"id": "34642f7cb7dae151",
"attachments": {
"9df74c62-e54f-4a47-a2cf-de8260dc1e33.png": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlkAAAAgCAIAAACuKPowAAAAT0lEQVR4Xu3BAQ0AAADCoPdPbQ43oAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAdwPhgAABhn0ZlwAAAABJRU5ErkJggg=="
},
"277270f1-1db4-4c92-ae1d-c06d1a2f1f97.png": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlkAAAAgCAIAAACuKPowAAAAT0lEQVR4Xu3BAQ0AAADCoPdPbQ43oAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAdwPhgAABhn0ZlwAAAABJRU5ErkJggg=="
}
}
},
{
"metadata": {},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"source": "",
"id": "a3a36eeb3ddab3a9"
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}