Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2022 – 144
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ganepola G.A.S.L IT19050386
2022 – 144
Commits
12ac6050
Commit
12ac6050
authored
Oct 09, 2022
by
Ganepola G.A.S.L IT19050386
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
plot graphs for stress detection
parent
a7474ea4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
114 additions
and
0 deletions
+114
-0
Stress_detection_-_Research.py
Stress_detection_-_Research.py
+114
-0
No files found.
Stress_detection_-_Research.py
0 → 100644
View file @
12ac6050
#!/usr/bin/env python
# coding: utf-8
# In[18]:
#import libraies
import
pandas
as
pd
import
numpy
as
np
import
matplotlib.pyplot
as
plot
import
seaborn
as
sb
import
seaborn
as
sns
# In[2]:
#insert data set
data
=
pd
.
read_csv
(
"C:
\\
Users
\\
USER
\\
Downloads
\\
archive (1)
\\
SaYoPillow.csv"
)
# In[3]:
data
.
head
()
# In[5]:
data
.
shape
# In[6]:
#renameing the columns
data
.
columns
=
[
'snoring_rate'
,
'respiration_rate'
,
'body_temperature'
,
'limb_movement'
,
'blood_oxygen'
,
'eye_movement'
,
'sleeping_hours'
,
'heart_rate'
,
'stress_level'
]
# In[7]:
data
.
head
()
# In[10]:
sorted
(
data
.
stress_level
.
unique
())
# In[11]:
data
.
stress_level
.
value_counts
()
# In[12]:
print
(
"Average amount of sleep (median):"
,
data
.
sleeping_hours
.
median
())
# In[13]:
print
(
"Average amount of stress (median):"
,
data
.
stress_level
.
median
())
# In[14]:
#checking for nulls
# In[15]:
if
not
data
.
isnull
()
.
values
.
any
():
print
(
"Done!!!"
)
else
:
print
(
"((("
)
# In[16]:
#make a simple plots
# In[23]:
sleep_hours_plot
=
sns
.
lineplot
(
data
=
data
,
x
=
'stress_level'
,
y
=
'sleeping_hours'
,
color
=
'red'
)
sleep_hours_plot
.
axes
.
set_title
(
"Dependence of stress level on sleep hours"
,
fontsize
=
16
)
sleep_hours_plot
.
set_xlabel
(
"Stress level"
,
fontsize
=
14
)
sleep_hours_plot
.
set_ylabel
(
"Sleep hours"
,
fontsize
=
14
)
# In[22]:
heart_rate_plot
=
sns
.
lineplot
(
data
=
data
,
x
=
'stress_level'
,
y
=
'sleeping_hours'
,
color
=
'green'
)
heart_rate_plot
.
axes
.
set_title
(
"Dependence of stress level on heart rate"
,
fontsize
=
16
)
heart_rate_plot
.
set_xlabel
(
"Stress level"
,
fontsize
=
14
)
heart_rate_plot
.
set_ylabel
(
"Heart rate"
,
fontsize
=
14
)
# In[ ]:
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment