From 7edf99f8f2b31a311c7ad02e8073c49c99d301c5 Mon Sep 17 00:00:00 2001 From: Michael Hoss Date: Tue, 30 Jan 2024 17:48:39 +0100 Subject: [PATCH] Only update index of "copy" df if it is not empty --- motmetrics/mot.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/motmetrics/mot.py b/motmetrics/mot.py index ec7ae59..87d1a70 100644 --- a/motmetrics/mot.py +++ b/motmetrics/mot.py @@ -454,7 +454,8 @@ def merge_event_dataframes(dfs, update_frame_indices=True, update_oids=True, upd next_frame_id = max(r.index.get_level_values(0).max() + 1, r.index.get_level_values(0).unique().shape[0]) if np.isnan(next_frame_id): next_frame_id = 0 - copy.index = copy.index.map(lambda x: (x[0] + next_frame_id, x[1])) + if not copy.index.empty: + copy.index = copy.index.map(lambda x: (x[0] + next_frame_id, x[1])) infos['frame_offset'] = next_frame_id # Update object / hypothesis ids