Document extract_stressful_events.
parent
dbb2033f78
commit
471ce7c2cb
|
@ -25,6 +25,25 @@ GROUP_QUESTIONNAIRES_BY = [
|
||||||
|
|
||||||
|
|
||||||
def extract_stressful_events(df_esm: pd.DataFrame) -> pd.DataFrame:
|
def extract_stressful_events(df_esm: pd.DataFrame) -> pd.DataFrame:
|
||||||
|
"""
|
||||||
|
Extract information about stressful events.
|
||||||
|
|
||||||
|
Participants were asked: "Was there a particular event that created tension in you?"
|
||||||
|
Then a subset of questions related to this event followed.
|
||||||
|
This function goes through the follow-up questions one by one
|
||||||
|
and preprocesses them, so that it adds new columns to the dataframe.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
df_esm: pd.DataFrame
|
||||||
|
A raw dataframe of all ESM data.
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
df_esm_events: pd.DataFrame
|
||||||
|
A cleaned up df of Stress Appraisal Measure items with additional columns.
|
||||||
|
|
||||||
|
"""
|
||||||
# 0. Select only questions from Stress Appraisal Measure.
|
# 0. Select only questions from Stress Appraisal Measure.
|
||||||
df_esm_preprocessed = features.esm.preprocess_esm(df_esm)
|
df_esm_preprocessed = features.esm.preprocess_esm(df_esm)
|
||||||
df_esm_sam = df_esm_preprocessed[
|
df_esm_sam = df_esm_preprocessed[
|
||||||
|
|
Loading…
Reference in New Issue