Skip to content

Commit 14562ce

Browse files
committed
ENH: Add type check for DatetimeIndex in _to_datetime_with_unit
1 parent 4924a6d commit 14562ce

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pandas/core/tools/datetimes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,8 @@ def _to_datetime_with_unit(arg, unit, name, utc: bool, errors: str) -> Index:
566566
)
567567

568568
result = DatetimeIndex(arr, name=name)
569+
if not isinstance(result, DatetimeIndex):
570+
return result
569571

570572
# GH#23758: We may still need to localize the result with tz
571573
# GH#25546: Apply tz_parsed first (from arg), then tz (from caller)

0 commit comments

Comments
 (0)