Skip to content

Commit

Permalink
added warning when dataframe is being sorted
Browse files Browse the repository at this point in the history
  • Loading branch information
sjvenditto committed Jan 7, 2025
1 parent 522cebb commit 83a8182
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pynapple/core/interval_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ def __init__(
# since metadata would be dropped if starts and ends are sorted separately
# note that if end times are still not sorted, metadata will be dropped
if np.any(start["start"].diff() < 0):
warnings.warn(
"DataFrame is not sorted by start times. Sorting it.", stacklevel=2
)
start = start.sort_values("start").reset_index(drop=True)

metadata = start.drop(columns=["start", "end"])
Expand Down

0 comments on commit 83a8182

Please sign in to comment.