From a13b78396985c8d713c9e5b3aee81a7b8d8cbec7 Mon Sep 17 00:00:00 2001 From: Shing Chan Date: Wed, 24 Apr 2024 21:08:19 +0100 Subject: [PATCH] chore(impute_missing): use coarser granularity: 1min -> 5min windows --- src/stepcount/stepcount.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/stepcount/stepcount.py b/src/stepcount/stepcount.py index 1dea9cc..52dcb1c 100644 --- a/src/stepcount/stepcount.py +++ b/src/stepcount/stepcount.py @@ -423,13 +423,13 @@ def fillna(subframe): data = ( data # first attempt imputation using same day of week - .groupby([data.index.weekday, data.index.hour, data.index.minute]) + .groupby([data.index.weekday, data.index.hour, data.index.minute // 5]) .transform(fillna) # then try within weekday/weekend - .groupby([data.index.weekday >= 5, data.index.hour, data.index.minute]) + .groupby([data.index.weekday >= 5, data.index.hour, data.index.minute // 5]) .transform(fillna) # finally, use all other days - .groupby([data.index.hour, data.index.minute]) + .groupby([data.index.hour, data.index.minute // 5]) .transform(fillna) )