Skip to content

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

Merged

Conversation

gfyoung
Copy link
Member

@gfyoung gfyoung commented Aug 27, 2016

  1. Deprecate NaT.to_datetime
  2. Deprecate Timestamp.to_datetime
  3. Issue UserWarning in Timestamp.to_datetime when nanoseconds is non-zero

NaT is also a _Timestamp, so the second deprecation covered the first one as well.

Closes #8254.

@gfyoung gfyoung force-pushed the ts-to-datetime-depr branch from c449999 to 386c6a0 Compare August 27, 2016 17:52
cdef:
pandas_datetimestruct dts
_TSObject ts

if self.nanosecond != 0 and warn:
print 'Warning: discarding nonzero nanoseconds'
Copy link
Contributor

Choose a reason for hiding this comment

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

print(..)

Copy link
Contributor

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

Copy link
Member

Choose a reason for hiding this comment

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

+1

Copy link
Contributor

Choose a reason for hiding this comment

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

UserWarning I think ok

@codecov-io
Copy link

codecov-io commented Aug 27, 2016

Current coverage is 85.26% (diff: 100%)

Merging #14101 into master will decrease coverage by <.01%

@@             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          

Powered by Codecov. Last update a0151a7...1fe9f46

@jorisvandenbossche jorisvandenbossche added the Deprecate Functionality to remove in pandas label Aug 27, 2016
@jorisvandenbossche jorisvandenbossche added this to the 0.19.0 milestone Aug 27, 2016

if self.nanosecond != 0 and warn:
warnings.warn("Discarding nonzero nanoseconds in conversion",
UserWarning, stacklevel=2)
Copy link
Contributor

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

Copy link
Member Author

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.

@gfyoung gfyoung force-pushed the ts-to-datetime-depr branch from 2a73742 to 0de77be Compare August 28, 2016 01:28
@gfyoung gfyoung force-pushed the ts-to-datetime-depr branch from 0de77be to 1fe9f46 Compare August 28, 2016 02:39
@gfyoung
Copy link
Member Author

gfyoung commented Aug 28, 2016

@jorisvandenbossche , @jreback : Travis is giving the green light, so this should be ready to merge if there are no other concerns.

@jorisvandenbossche jorisvandenbossche merged commit a9c15d3 into pandas-dev:master Aug 29, 2016
@jorisvandenbossche
Copy link
Member

@gfyoung Thanks!

@gfyoung gfyoung deleted the ts-to-datetime-depr branch August 30, 2016 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecate Functionality to remove in pandas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants