Skip to content

Commit

Permalink
ENH: Add type check for DatetimeIndex in _to_datetime_with_unit
Browse files Browse the repository at this point in the history
  • Loading branch information
kosiew committed Jan 31, 2025
1 parent 4924a6d commit 14562ce
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pandas/core/tools/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,8 @@ def _to_datetime_with_unit(arg, unit, name, utc: bool, errors: str) -> Index:
)

result = DatetimeIndex(arr, name=name)
if not isinstance(result, DatetimeIndex):
return result

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

0 comments on commit 14562ce

Please sign in to comment.