From 41e94891090eccd3e828dfe90c8f4c65a5fbbc7a Mon Sep 17 00:00:00 2001 From: Bartosz Trams <51712687+smartbackwards@users.noreply.github.com> Date: Tue, 1 Jul 2025 00:26:52 +0200 Subject: [PATCH] fixed InvalidOperationError bug --- awpy/parsers/rounds.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/awpy/parsers/rounds.py b/awpy/parsers/rounds.py index cbcc57e90..d31b4edf3 100644 --- a/awpy/parsers/rounds.py +++ b/awpy/parsers/rounds.py @@ -227,6 +227,9 @@ def apply_round_num(df: pl.DataFrame, rounds_df: pl.DataFrame, tick_col: str = " "round_num" column that indicates the round in which the event occurs. If no matching round is found, "round_num" will be null. """ + # prevents InvalidOperationError on some demos in which the tick column isn't pre-sorted + df = df.sort(tick_col) + # Use join_asof to get the round where round.start <= event.tick. # This join will add the columns 'round_num', 'start', and 'end' from rounds_df. df_with_round = df.join_asof(