Fix a bug where evening EMAs where also reclassified as daytime.

communication
junos 2021-06-11 20:17:17 +02:00
parent 294d4a2b49
commit 7a12f68dfe
1 changed files with 8 additions and 4 deletions

View File

@ -196,7 +196,9 @@ def classify_sessions_by_completion_time(
Returns
-------
object
df_session_counts_time: pd.DataFrame
A dataframe of all sessions (grouped by GROUP_SESSIONS_BY) with statuses, the number of items,
their time type (with some morning EMAs reclassified) and timestamp of first answer.
"""
df_session_counts = classify_sessions_by_completion(df_esm_preprocessed)
@ -204,8 +206,10 @@ def classify_sessions_by_completion_time(
df_session_counts_time = df_session_time.join(df_session_counts)
df_session_counts_time.loc[
df_session_counts_time.esm_session_count > MAX_MORNING_LENGTH, "time"
] = "daytime"
morning_transition_to_daytime = (df_session_counts_time.time == "morning") & (
df_session_counts_time.esm_session_count > MAX_MORNING_LENGTH
)
df_session_counts_time.loc[morning_transition_to_daytime, "time"] = "daytime"
return df_session_counts_time