-
Notifications
You must be signed in to change notification settings - Fork 0
Coerce frame interval columns to int before exploding #55
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -498,6 +498,10 @@ def generate_output_paths(results_folder: Path): | |
| def _expand_intervals_to_frames(df): | ||
| """Expand behavior intervals into per-frame rows.""" | ||
| expanded = df.copy() | ||
| # Ensure integer frame boundaries so range() receives ints even if upstream data was cast to float | ||
| for col in ["animal_idx", "start", "duration"]: | ||
| if col in expanded.columns: | ||
| expanded[col] = pd.to_numeric(expanded[col], errors="coerce").fillna(0).astype(int) | ||
|
Comment on lines
+503
to
+504
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just wondering about the consequence of turning errors into |
||
| expanded["frame"] = expanded.apply( | ||
| lambda row: range(row["start"], row["start"] + row["duration"]), axis=1 | ||
| ) | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are "animal_idx" always integers? I think that is the case with all the system that we have, but just want to make sure.