Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
PERF/TYP: typing cast in __getitem__ gives quite some overhead
  • Loading branch information
jorisvandenbossche committed Nov 26, 2021
commit 6682309fbaffc456fd04ebead0b8a83df226187b
7 changes: 4 additions & 3 deletions pandas/core/arrays/datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,10 @@ def __getitem__(
only handle list-likes, slices, and integer scalars
"""
# Use cast as we know we will get back a DatetimeLikeArray or DTScalar
result = cast(
Union[DatetimeLikeArrayT, DTScalarOrNaT], super().__getitem__(key)
)
# result = cast(
# Union[DatetimeLikeArrayT, DTScalarOrNaT], super().__getitem__(key)
# )
result = super().__getitem__(key)
if lib.is_scalar(result):
return result
else:
Expand Down