-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
BUG: pd.DateOffset handle milliseconds #50020
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
Changes from 4 commits
48d9dfa
65cd5da
f989674
b3a5ef1
37427dd
705d2d6
c1be7c6
1788491
ae0b529
64c9ee3
65015c8
ef7f118
b2b7473
c2cf081
3981b04
d80e780
27109a7
76fafe2
2ad8c60
2f913a8
8eb83d0
309e296
0d85a74
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -314,6 +314,9 @@ cdef _determine_offset(kwds): | |
|
||
use_relativedelta = False | ||
if len(kwds_no_nanos) > 0: | ||
if "milliseconds" in kwds_no_nanos: | ||
return timedelta(**kwds_no_nanos), use_relativedelta | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you assign to |
||
|
||
if any(k in _kwds_use_relativedelta for k in kwds_no_nanos): | ||
if "millisecond" in kwds_no_nanos: | ||
raise NotImplementedError( | ||
|
@@ -1163,7 +1166,6 @@ cdef class RelativeDeltaOffset(BaseOffset): | |
|
||
def __init__(self, n=1, normalize=False, **kwds): | ||
BaseOffset.__init__(self, n, normalize) | ||
|
||
off, use_rd = _determine_offset(kwds) | ||
object.__setattr__(self, "_offset", off) | ||
object.__setattr__(self, "_use_relativedelta", use_rd) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -739,6 +739,14 @@ def test_eq(self): | |
|
||
assert DateOffset(milliseconds=3) != DateOffset(milliseconds=7) | ||
|
||
def test_milliseconds_combination(self): | ||
""" | ||
markopacak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
The combination of 'milliseconds' (plural) and another parameter | ||
should not raise an error. | ||
See https://github.com/pytest-dev/pytest/issues/10525 | ||
""" | ||
DateOffset(days=1, milliseconds=1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add an assertion that the object has been properly constructed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
|
||
|
||
class TestOffsetNames: | ||
def test_get_offset_name(self): | ||
|
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 we be more specific? like
Bug in :class:
DateOffset` was throwing ``TypeError```..., or whatever it was