-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Timedelta/Timestamp round support non-nano #47356
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
@@ -1932,7 +1932,8 @@ def _round(self, freq, mode, ambiguous, nonexistent): | |||
|
|||
values = self.view("i8") | |||
values = cast(np.ndarray, values) | |||
nanos = to_offset(freq).nanos | |||
nanos = to_offset(freq).nanos # raises on non-fixed frequencies |
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.
Do we have tests that trigger the raising behavior?
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.
Yes
@@ -148,11 +148,13 @@ def test_round_minute_freq(self, test_input, freq, expected, rounder): | |||
result = func(freq) | |||
assert result == expected | |||
|
|||
def test_ceil(self): | |||
dt = Timestamp("20130101 09:10:11") | |||
@pytest.mark.parametrize("unit", ["ns", "us", "ms", "s"]) |
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.
Could you parameterize test_ceil
below too?
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.
good idea, updated
* ENH: Timedelta/Timestamp round support non-nano * parametrize test_floor * un-xfail
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.