Skip to content

Commit 83a8182

Browse files
committed
added warning when dataframe is being sorted
1 parent 522cebb commit 83a8182

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pynapple/core/interval_set.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,9 @@ def __init__(
201201
# since metadata would be dropped if starts and ends are sorted separately
202202
# note that if end times are still not sorted, metadata will be dropped
203203
if np.any(start["start"].diff() < 0):
204+
warnings.warn(
205+
"DataFrame is not sorted by start times. Sorting it.", stacklevel=2
206+
)
204207
start = start.sort_values("start").reset_index(drop=True)
205208

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

0 commit comments

Comments
 (0)