Skip to content

Updated the return type section of to_datetime #42244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 11, 2021
Merged
Changes from all 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
4 changes: 3 additions & 1 deletion pandas/core/tools/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,9 @@ 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 time offsets
- Series: Series of datetime64 dtype
- scalar: Timestamp

Expand Down