Skip to content

Commit cdc07fd

Browse files
qwhelanjreback
authored andcommitted
PERF: restore DatetimeIndex.__iter__ performance by using non-EA implementation (#26702)
1 parent 3ff4f38 commit cdc07fd

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

doc/source/whatsnew/v0.25.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,7 @@ Performance Improvements
513513
- Improved performance of :meth:`IntervalIndex.intersection` (:issue:`24813`)
514514
- Improved performance of :meth:`read_csv` by faster concatenating date columns without extra conversion to string for integer/float zero and float ``NaN``; by faster checking the string for the possibility of being a date (:issue:`25754`)
515515
- Improved performance of :attr:`IntervalIndex.is_unique` by removing conversion to ``MultiIndex`` (:issue:`24813`)
516+
- Restored performance of :meth:`DatetimeIndex.__iter__` by re-enabling specialized code path (:issue:`26702`)
516517

517518
.. _whatsnew_0250.bug_fixes:
518519

pandas/core/indexes/datetimes.py

+2
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,8 @@ def _join_i8_wrapper(joinf, **kwargs):
243243
_is_numeric_dtype = False
244244
_infer_as_myclass = True
245245

246+
# Use faster implementation given we know we have DatetimeArrays
247+
__iter__ = DatetimeArray.__iter__
246248
# some things like freq inference make use of these attributes.
247249
_bool_ops = DatetimeArray._bool_ops
248250
_object_ops = DatetimeArray._object_ops

0 commit comments

Comments
 (0)