PERF: MultiIndex.argsort / MultiIndex.sort_values by lukemanley · Pull Request #48406 · pandas-dev/pandas (original) (raw)
- Tests added and passed if fixing a bug or adding a new feature
- All code checks passed.
- Added type annotations to new arguments/methods/functions.
- Added an entry in the latest
doc/source/whatsnew/v1.6.0.rst
file if fixing a bug or adding a new feature.
Perf improvement in MultiIndex.argsort
and MultiIndex.sort_values
for the vast majority of cases (where MultiIndex.argsort
is called without additional passthrough numpy parameters).
Also, an xfail was removed because np.lexsort does not complain about complex dtype arrays whereas np.argsort will complain about an object array of tuples containing complex and non-complex dtypes.
ASV added:
before after ratio
[fa211d47] [b2fea756]
<main> <perf-multiindex-argsort>
- 81.0±0.9ms 27.9±0.7ms 0.34 multiindex_object.SortValues.time_sort_values('Int64')
- 96.9±2ms 2.00±0.2ms 0.02 multiindex_object.SortValues.time_sort_values('int64')