Skip to content

Commit 7210fcc

Browse files
authored
Only update index of "copy" df if it is not empty (#188)
thanks, merging
1 parent 8c25d76 commit 7210fcc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

motmetrics/mot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,8 @@ def merge_event_dataframes(dfs, update_frame_indices=True, update_oids=True, upd
454454
next_frame_id = max(r.index.get_level_values(0).max() + 1, r.index.get_level_values(0).unique().shape[0])
455455
if np.isnan(next_frame_id):
456456
next_frame_id = 0
457-
copy.index = copy.index.map(lambda x: (x[0] + next_frame_id, x[1]))
457+
if not copy.index.empty:
458+
copy.index = copy.index.map(lambda x: (x[0] + next_frame_id, x[1]))
458459
infos['frame_offset'] = next_frame_id
459460

460461
# Update object / hypothesis ids

0 commit comments

Comments
 (0)