Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Symptom clustering analysis
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mcoth
Symptom clustering analysis
Commits
32578b4f
Commit
32578b4f
authored
4 months ago
by
mcoth
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
a00e9b93
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#38560
passed with warnings
4 months ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Import_data.py
+44
-0
44 additions, 0 deletions
Import_data.py
with
44 additions
and
0 deletions
Import_data.py
0 → 100644
+
44
−
0
View file @
32578b4f
"""
Created on Sun Sep 1 12:13:23 2024
@author: Maya Coulson Theodorsen (mcoth@dtu.dk)
This script imports the CSV data file, drops participants who have not consented
to their data being used for research, filters incomplete datasets, keeps only
one dataset for each participant
"""
#Import all necessary packages
import
pandas
as
pd
# Define import of data
def
load_data
(
file_path
):
# Import data
data_original
=
pd
.
read_csv
(
"
data6_9_2023.csv
"
,
encoding
=
'
latin-1
'
,
sep
=
'
;
'
)
data
=
data_original
print
(
'
Total amount of participants/measurements:
'
,
data
.
shape
[
0
])
# Delete the data of individuals who do not consent to research
data
=
data
.
drop
(
data
.
index
[
data
[
'
Forskning
'
]
==
False
])
#Check the counts to make sure all who haven't consented are deleted
data
[
'
Forskning
'
].
value_counts
()
#Display amout that have given consent
print
(
'
Total amount of participants wtih consent:
'
,
data
.
shape
[
0
])
# Delete incomplete datasets, drop duplicates
data
=
data
[
data
[
'
PCL_t0
'
].
notna
()]
data
=
data
[
data
[
'
DASS_D_t0
'
].
notna
()]
data
=
data
[
data
[
'
DASS_S_t0
'
].
notna
()]
data
=
data
[
data
[
'
DASS_A_t0
'
].
notna
()]
data
=
data
[
data
[
'
q0003_0001
'
].
notna
()]
data
=
data
.
drop_duplicates
(
subset
=
'
lbnr
'
)
print
(
'
Total amount of unique participants wtih complete data:
'
,
data
.
shape
[
0
])
data_complete
=
data
.
copy
()
data_complete
=
data_complete
.
reset_index
()
return
data_complete
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment