Skip to content

Commit 6aa94e9

Browse files
committed
adjust for that is_monotonic uses fused types
1 parent c9f1166 commit 6aa94e9

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

doc/source/whatsnew/v0.24.0.txt

+4-3
Original file line numberDiff line numberDiff line change
@@ -591,9 +591,10 @@ Removal of prior version deprecations/changes
591591
Performance Improvements
592592
~~~~~~~~~~~~~~~~~~~~~~~~
593593

594-
- Very large improvement in performance of slicing when the index is a :class:`CategoricalIndex`,
595-
both when indexing by label (using .loc) and position(.iloc).
596-
Likewise, slicing a ``CategoricalIndex`` itself (i.e. ``ci[100:200]``) shows similar speed improvements (:issue:`21659`)
594+
- Slicing Series and Dataframe with an monotonically increasing :class:`CategoricalIndex`
595+
is now very fast and has speed comparable to slicing with an ``Int64Index``.
596+
The speed increase is both when indexing by label (using .loc) and position(.iloc) (:issue:`20395`)
597+
- Slicing a ``CategoricalIndex`` itself (i.e. ``ci[1000:2000]``) shows similar speed improvements as above (:issue:`21659`)
597598
- Improved performance of :func:`Series.describe` in case of numeric dtpyes (:issue:`21274`)
598599
- Improved performance of :func:`pandas.core.groupby.GroupBy.rank` when dealing with tied rankings (:issue:`21237`)
599600
- Improved performance of :func:`DataFrame.set_index` with columns consisting of :class:`Period` objects (:issue:`21582`, :issue:`21606`)

pandas/_libs/algos.pyx

+5-1
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,13 @@ ctypedef fused algos_t:
361361
float64_t
362362
float32_t
363363
object
364-
int32_t
365364
int64_t
365+
int32_t
366+
int16_t
367+
int8_t
366368
uint64_t
369+
uint32_t
370+
uint16_t
367371
uint8_t
368372

369373

pandas/_libs/index_class_helper.pxi.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ cdef class {{name}}Engine(IndexEngine):
3333
_dtype = '{{dtype}}'
3434

3535
def _call_monotonic(self, values):
36-
return algos.is_monotonic_{{dtype}}(values, timelike=False)
36+
return algos.is_monotonic(values, timelike=False)
3737

3838
def get_backfill_indexer(self, other, limit=None):
3939
return algos.backfill_{{dtype}}(self._get_index_values(),

0 commit comments

Comments
 (0)