-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
DOC: Improve to_datetime() documentation #41049
Conversation
Returns Object Type Index when Mixed Timezones are used in list-like input to pandas.to_datetime()
Hello @chinmayrane! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2021-04-21 13:33:33 UTC |
Removed Trailing WhiteSpace
pandas/core/tools/datetimes.py
Outdated
@@ -786,6 +786,10 @@ def to_datetime( | |||
return will have datetime.datetime type (or corresponding | |||
array/Series). | |||
|
|||
In case input is list-like and the elements of input are of mixed |
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.
Mind adding this paragraph and an example in the Examples
section?
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.
Sure, I've added it with the Examples
section.
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.
This paragraph can now be removed since you have it in the examples now
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.
sure, will remove it from the Returns
Add Examples for the mixed Timezones for pandas.to_datetime()
Add Examples for the mixed Timezones for pandas.to_datetime()
Test Failure seems unrelated. This is my first PR, so wanted to make sure, if I understand it correctly. Seeing Error on -
Also got a pop up on the Azure Pipeline that this test has failed |
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.
LGTM (that is a known flakey test in our CI, so unrelated to this PR)
@mroeschke Thanks! |
pandas/core/tools/datetimes.py
Outdated
@@ -853,6 +857,13 @@ def to_datetime( | |||
... origin=pd.Timestamp('1960-01-01')) | |||
DatetimeIndex(['1960-01-02', '1960-01-03', '1960-01-04'], \ | |||
dtype='datetime64[ns]', freq=None) | |||
|
|||
In case input is list-like and the elements of input are of mixed | |||
timezones, return will have object type Index if utc parameter is not |
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.
say if utc=False
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.
added
pandas/core/tools/datetimes.py
Outdated
@@ -786,6 +786,10 @@ def to_datetime( | |||
return will have datetime.datetime type (or corresponding | |||
array/Series). | |||
|
|||
In case input is list-like and the elements of input are of mixed | |||
timezones, return will have object type Index if utc parameter is not |
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.
say if utc=False
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.
added
timezones, return will have object type Index if utc parameter is not | ||
passed in as True. | ||
|
||
>>> pd.to_datetime(['2018-10-26 12:00 -0530', '2018-10-26 12:00 -0500']) |
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.
ok to show the same example with utc=True as well
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.
Added an example with utc=True
Add Examples for utc=True, For mixed Timezones on function pandas.to_datetime(), Edit Description to specify utc=False instead of verbose text about parameter
Remove Text fromReturns Section as it's specified in the Examples
pandas/core/tools/datetimes.py
Outdated
>>> pd.to_datetime(['2018-10-26 12:00 -0530', '2018-10-26 12:00 -0500'], | ||
... utc=True) | ||
DatetimeIndex(['2018-10-26 17:30:00+00:00', '2018-10-26 17:00:00+00:00'], \ | ||
dtype='datetime64[ns, UTC]', freq=None) |
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.
does this render properly?
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.
Fix a rendering Issue so that the DateTimeIndex Output is split on 2 lines
@@ -853,6 +853,17 @@ def to_datetime( | |||
... origin=pd.Timestamp('1960-01-01')) | |||
DatetimeIndex(['1960-01-02', '1960-01-03', '1960-01-04'], \ | |||
dtype='datetime64[ns]', freq=None) | |||
|
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.
can you fix the one right above as well, thanks.
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.
Sure. Have fixed the example above.
Fix a rendering Issue so that the DateTimeIndex Output is split on 2 lines
thanks @chinmayrane |
Returns Object Type Index when Mixed Timezones are used in list-like input to pandas.to_datetime()