-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC:updated docstring in .to_datetime() #14452
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
keshavramaswamy
commented
Oct 19, 2016
•
edited
Loading
edited
- closes DOC/BUG: pd.to_datetime example produces different results from documentation #14448
- tests added / passed
- passes git diff upstream/master | flake8 --diff
- whatsnew entry
Current coverage is 85.25% (diff: 100%)@@ master #14452 diff @@
==========================================
Files 140 140
Lines 50631 50655 +24
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 43166 43185 +19
- Misses 7465 7470 +5
Partials 0 0
|
@@ -270,7 +270,7 @@ def to_datetime(arg, errors='raise', dayfirst=False, yearfirst=False, | |||
If a date that does not meet timestamp limitations, passing errors='coerce' | |||
will force to NaT. Furthermore this will force non-dates to NaT as well. | |||
|
|||
>>> pd.to_datetime('13000101', format='%Y%m%d') | |||
>>> pd.to_datetime('13000101', format='%Y%m%d', errors='ignore') |
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.
it's nice to add an example of default behavior, and describe what the timestamp limitation is.
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.
@sinhrks sure.
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 u add it to the docstring?
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.
makes sense - I'll do that!
|
@sinhrks Can this be merged? |
@jreback Can this be merged? Please let me know if there are any changes to be added. |
@@ -267,10 +268,15 @@ def to_datetime(arg, errors='raise', dayfirst=False, yearfirst=False, | |||
1 2016-03-05 | |||
dtype: datetime64[ns] | |||
|
|||
If a date that does not meet timestamp limitations, passing errors='coerce' | |||
will force to NaT. Furthermore this will force non-dates to NaT as well. | |||
Since pandas represents timestamps in nanosecond resolution, the timespan |
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 sentence is not a complete explanation; instead you can simply refer to a link in the docs about min/max values that are supported.
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.
thanks! |
…for out-of-bounds timestamps with errors='ignore' closes pandas-dev#14448 Author: Keshav Ramaswamy <[email protected]> Author: Keshav Ramaswamy <[email protected]> Closes pandas-dev#14452 from keshavramaswamy/master and squashes the following commits: 5468fc5 [Keshav Ramaswamy] added link to timestamp limitations in docstring 3aa78cf [Keshav Ramaswamy] edit docstring to fit python standards 8bfa58e [Keshav Ramaswamy] edited docstring to fit python standards 5ed8ef5 [Keshav Ramaswamy] edut docstring to fit Python Standards 7402de4 [Keshav Ramaswamy] edited docstring to fit python standards c16ad6b [Keshav Ramaswamy] added timestamp limitations and default behavior to docstring 0db07b5 [Keshav Ramaswamy] updated docstring in .to_datetime() (cherry picked from commit 18fba53)