Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pandas/core/tools/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,10 +762,13 @@ def to_datetime(
If parsing succeeded.
Return type depends on input:

- list-like: DatetimeIndex
- list-like:
- DatetimeIndex, if timezone naive or aware with the same timezone
Copy link
Contributor

@smarie smarie Jun 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed in #42229 (comment)

Suggested change
- DatetimeIndex, if timezone naive or aware with the same timezone
- DatetimeIndex, if timezone naive or aware with the same time offset

- Index of object dtype, if timezone aware with mixed timezones
- Series: Series of datetime64 dtype
- scalar: Timestamp


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Could you remove this newline?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I can

In case when it is not possible to return designated types (e.g. when
any element of input is before Timestamp.min or after Timestamp.max)
return will have datetime.datetime type (or corresponding
Expand Down