Skip to content

Commit

Permalink
chore(impute_missing): use coarser granularity: 1min -> 5min windows
Browse files Browse the repository at this point in the history
  • Loading branch information
chanshing committed Apr 26, 2024
1 parent 8ae69cf commit 4f8913a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/stepcount/stepcount.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)

Expand Down

0 comments on commit 4f8913a

Please sign in to comment.