Skip to content
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: Removed line about %S parses all the way up to nanosecond even if no #49349

Merged
merged 13 commits into from
Oct 28, 2022
Merged
17 changes: 1 addition & 16 deletions pandas/core/tools/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,15 +782,7 @@ def to_datetime(
`strftime documentation
<https://docs.python.org/3/library/datetime.html
#strftime-and-strptime-behavior>`_ for more information on choices, though
note the following differences:

- :const:`"%f"` will parse all the way
up to nanoseconds;

- :const:`"%S"` without :const:`"%f"` will capture all the way
up to nanoseconds if present as decimal places, and will also handle
the case where the number of seconds is an integer.

Comment on lines -790 to -793
Copy link
Member

Choose a reason for hiding this comment

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

Now, the preceding paragraph says "though note the following difference", but then there's only one difference.

Perhaps we can change it to something like

though note that "%f" will parse all the way up to nanoseconds

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I have made the necessary changes

note that :const:`"%f"` will parse all the way up to nanoseconds.
exact : bool, default True
Control how `format` is used:

Expand Down Expand Up @@ -969,13 +961,6 @@ def to_datetime(
... format='%Y-%m-%d %H:%M:%S.%f')
Timestamp('2018-10-26 12:00:00.000000001')

:const:`"%S"` without :const:`"%f"` will capture all the way
up to nanoseconds if present as decimal places.

Comment on lines -972 to -974
Copy link
Member

Choose a reason for hiding this comment

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

you also need to remove the example code that follows

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for bringing this to my notice, I have deleted the example code.

>>> pd.to_datetime('2017-03-22 15:16:45.433502912',
... format='%Y-%m-%d %H:%M:%S')
Timestamp('2017-03-22 15:16:45.433502912')

**Non-convertible date/times**

If a date does not meet the `timestamp limitations
Expand Down