Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use coarser grid in imputation: 1-min -> 5-min grid #85

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading