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

BUG/DEPR: Timestamp/Timedelta resolution #29910

Merged
merged 4 commits into from
Nov 29, 2019

Conversation

jbrockmendel
Copy link
Member

Timedelta.resolution used to return a string, but that was deprecated in 0.25.0. Enforce that deprecation to return Timedelta(nanoseconds=1), mirroring the stdlib timedelta.resolution behavior.

Timestamp.resolution correctly mirrors datetime.resolution by returning Timedelta(nanoseconds=1), but it is a property whereas for the stdlib it is a class attribute. This PR makes it a class attribute for Timestamp.

@@ -804,9 +804,13 @@ def test_resolution_string(self):
def test_resolution_deprecated(self):
Copy link
Member

Choose a reason for hiding this comment

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

Maybe rename this test to just test_resolution

@@ -1602,3 +1552,4 @@ cdef _broadcast_floordiv_td64(int64_t value, object other,
# resolution in ns
Timedelta.min = Timedelta(np.iinfo(np.int64).min + 1)
Timedelta.max = Timedelta(np.iinfo(np.int64).max)
Timedelta.resolution = Timedelta(nanoseconds=1)
Copy link
Member

Choose a reason for hiding this comment

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

Think a newline is needed here.

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

lgtm ex @mroeschke comments

@WillAyd WillAyd added Deprecate Functionality to remove in pandas Timedelta Timedelta data type labels Nov 29, 2019
@WillAyd WillAyd added this to the 1.0 milestone Nov 29, 2019
@jbrockmendel
Copy link
Member Author

updated+green

@mroeschke mroeschke merged commit 774fe7b into pandas-dev:master Nov 29, 2019
@mroeschke
Copy link
Member

Thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the depr-tz branch November 29, 2019 21:11
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
* BUG/DEPR: Timestamp/Timedelta resolution

* GH ref
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
* BUG/DEPR: Timestamp/Timedelta resolution

* GH ref
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 Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants