Skip to content

Commit

Permalink
Only update index of "copy" df if it is not empty (#188)
Browse files Browse the repository at this point in the history
thanks, merging
  • Loading branch information
michael-hoss authored Jan 30, 2024
1 parent 8c25d76 commit 7210fcc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion motmetrics/mot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7210fcc

Please sign in to comment.