cheind / py-motmetrics

:bar_chart: Benchmark multiple object trackers (MOT) in Python
MIT License
1.37k stars 259 forks source link

Sort MultiIndex to improve performance #124

Open cinabars opened 3 years ago

cinabars commented 3 years ago

Sorting a MultiIndex dataframe improves performance. In some cases, indexing a MultiIndex dataframe without sorting can even throw an UnsortedIndexError, so this change prevents that from occuring. (source: https://pandas.pydata.org/pandas-docs/stable/user_guide/advanced.html#sorting-a-multiindex)

cheind commented 3 years ago

Hey thanks for the PR!

Couple of comments: