-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
Conversation
…ixed timezone inputs
pandas/core/tools/datetimes.py
Outdated
@@ -765,6 +765,7 @@ def to_datetime( | |||
- list-like: DatetimeIndex | |||
- Series: Series of datetime64 dtype | |||
- scalar: Timestamp | |||
- list-like with mixed timezones: Index of object dtype |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually on second thought might be better to combine with list-like: DatetimeIndex
like
- Index:
- DatetimeIndex if timezone naive or aware with the same timezone
- Index of object dtype if timezone aware with mixed timezones
@mroeschke - updated as per you suggestion |
pandas/core/tools/datetimes.py
Outdated
- Series: Series of datetime64 dtype | ||
- scalar: Timestamp | ||
|
||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I can
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small comment otherwise LGTM
Removed the additional line , Thanks for patience and feedback @mroeschke |
@@ -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 |
There was a problem hiding this comment.
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)
- DatetimeIndex, if timezone naive or aware with the same timezone | |
- DatetimeIndex, if timezone naive or aware with the same time offset |
Co-authored-by: Sylvain Marié <sylvain.marie@schneider-electric.com>
Thanks @prabha-git |
Following pandas-dev#42244 , improved documentation about datetime parsing. See also pandas-dev#42229 (comment)
Hi @prabha-git and @mroeschke ! It seems that the resulting comment is half/half (half speaking about timezone, half speaking about time offset...). Therefore I created #42494 to complete this PR. |
Updated the return type section of to_datetime to include list-like mixed timezone inputs