From 8c0f6a000d6febdc6eaf891391ae45865067312c Mon Sep 17 00:00:00 2001 From: Meng Li <34143965+Meng6@users.noreply.github.com> Date: Mon, 19 Oct 2020 19:36:26 -0400 Subject: [PATCH] Fix chunk_episodes() bugs: set segment_start_timestamp as int --- src/features/utils/resample_episodes.R | 1 + src/features/utils/utils.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/features/utils/resample_episodes.R b/src/features/utils/resample_episodes.R index eac57f05..a32fd97e 100644 --- a/src/features/utils/resample_episodes.R +++ b/src/features/utils/resample_episodes.R @@ -1,4 +1,5 @@ source("renv/activate.R") +library("tibble") library("dplyr") library("tidyr") library("tibble") diff --git a/src/features/utils/utils.py b/src/features/utils/utils.py index d2060aee..79c08455 100644 --- a/src/features/utils/utils.py +++ b/src/features/utils/utils.py @@ -35,7 +35,7 @@ def chunk_episodes(sensor_episodes): sensor_episodes = sensor_episodes.copy() # Unix timestamp for current segment in milliseconds - sensor_episodes[["segment_start_timestamp", "segment_end_timestamp"]] = sensor_episodes["timestamps_segment"].str.split(",", expand=True) + sensor_episodes[["segment_start_timestamp", "segment_end_timestamp"]] = sensor_episodes["timestamps_segment"].str.split(",", expand=True).astype(int) # Compute chunked timestamp sensor_episodes["chunked_start_timestamp"] = sensor_episodes[["start_timestamp", "segment_start_timestamp"]].max(axis=1)