-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DEPR: Deprecate Timestamp.to_datetime #14101
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
DEPR: Deprecate Timestamp.to_datetime #14101
Conversation
c449999
to
386c6a0
Compare
cdef: | ||
pandas_datetimestruct dts | ||
_TSObject ts | ||
|
||
if self.nanosecond != 0 and warn: | ||
print 'Warning: discarding nonzero nanoseconds' |
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.
print(..)
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.
maybe we should make this an actual warning
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.
+1
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.
UserWarning I think ok
Current coverage is 85.26% (diff: 100%)@@ master #14101 diff @@
==========================================
Files 139 139
Lines 50502 50502
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
- Hits 43063 43062 -1
- Misses 7439 7440 +1
Partials 0 0
|
|
||
if self.nanosecond != 0 and warn: | ||
warnings.warn("Discarding nonzero nanoseconds in conversion", | ||
UserWarning, stacklevel=2) |
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.
hmm maybe RuntimeWarning is better? not sure when that is typically used
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.
I think user warning makes more sense here because this is converting user-provided data.
2a73742
to
0de77be
Compare
0de77be
to
1fe9f46
Compare
@jorisvandenbossche , @jreback : Travis is giving the green light, so this should be ready to merge if there are no other concerns. |
@gfyoung Thanks! |
NaT.to_datetime
Timestamp.to_datetime
UserWarning
inTimestamp.to_datetime
when nanoseconds is non-zeroNaT
is also a_Timestamp
, so the second deprecation covered the first one as well.Closes #8254.