From 1f8d102d6cb1cca7e2cf6cbddbe1e5df5f645c93 Mon Sep 17 00:00:00 2001 From: Wenjie Du Date: Tue, 18 Jun 2024 01:05:29 +0800 Subject: [PATCH] fix: wrong index when comparing; --- pypots/data/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pypots/data/utils.py b/pypots/data/utils.py index 90d0bb79..f6bc939b 100644 --- a/pypots/data/utils.py +++ b/pypots/data/utils.py @@ -197,8 +197,8 @@ def sliding_window(time_series, window_len, sliding_len=None): start_indices = np.asarray(range(total_len // sliding_len)) * sliding_len # remove the last one if left length is not enough - if total_len - start_indices[-1] * sliding_len < window_len: - to_drop = math.ceil(window_len / sliding_len) - 1 + if total_len - start_indices[-1] < window_len: + to_drop = math.ceil(window_len / sliding_len) left_len = total_len - start_indices[-1] start_indices = start_indices[:-to_drop] logger.warning(