Prepare data for export to CSV.
parent
cf3801b120
commit
0e6a18a660
|
@ -1,5 +1,6 @@
|
||||||
import datetime
|
import datetime
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
from pyprojroot import here
|
||||||
|
|
||||||
import participants.query_db
|
import participants.query_db
|
||||||
|
|
||||||
|
@ -25,3 +26,27 @@ participants_true_si = participants_overview_si[
|
||||||
participants_true_be = participants_overview_be[
|
participants_true_be = participants_overview_be[
|
||||||
participants_overview_be["SmartphoneBrand+Generation"].str.slice(0, 3) != "Not"
|
participants_overview_be["SmartphoneBrand+Generation"].str.slice(0, 3) != "Not"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Concatenate participants from both countries.
|
||||||
|
participants_usernames_empatica = pd.concat(
|
||||||
|
[participants_true_be, participants_true_si]
|
||||||
|
)
|
||||||
|
# Filter only the participants from the main study (queried from the database).
|
||||||
|
participants_usernames_empatica = participants_usernames_empatica[
|
||||||
|
participants_usernames_empatica["Username"].isin(participants_inactive_usernames)
|
||||||
|
]
|
||||||
|
# Rename and select columns.
|
||||||
|
participants_usernames_empatica = participants_usernames_empatica.rename(
|
||||||
|
columns={"Username": "label", "Wristband_SerialNo": "empatica_id"}
|
||||||
|
)[["label", "empatica_id"]]
|
||||||
|
# Adapt for csv export.
|
||||||
|
participants_usernames_empatica["empatica_id"] = participants_usernames_empatica[
|
||||||
|
"empatica_id"
|
||||||
|
].str.replace(",", ";")
|
||||||
|
|
||||||
|
participants_usernames_empatica.to_csv(
|
||||||
|
here("rapids/data/external/main_study_participants.csv"),
|
||||||
|
header=True,
|
||||||
|
index=False,
|
||||||
|
line_terminator="\n",
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in New Issue