-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG : assignment of non-ns timedelta64 value (GH14155) #14160
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
@@ -1696,7 +1696,7 @@ def _try_coerce_args(self, values, other): | |||
other = other.value | |||
elif isinstance(other, np.timedelta64): | |||
other_mask = isnull(other) | |||
other = other.view('i8') | |||
other = Timedelta(np.timedelta64(other)) |
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.
use Timedelta(other).value
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 you address this one? (EDIT not the .value
part, but the timedelta64
part)
The np.timedelta64(..)
is not needed given you just tested that it is already a np.timedelta64
object
tests might be in tseries/test_timedelta.py but more likely in index/test_indexing.py |
e090364
to
f9d3b0e
Compare
Current coverage is 85.24% (diff: 100%)@@ master #14160 diff @@
==========================================
Files 140 140
Lines 50549 50549
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
Hits 43091 43091
Misses 7458 7458
Partials 0 0
|
f9d3b0e
to
a6352cd
Compare
Added the call to other, and added a test in |
@@ -1478,3 +1478,4 @@ Bug Fixes | |||
|
|||
- Bug in ``eval()`` where the ``resolvers`` argument would not accept a list (:issue:`14095`) | |||
- Bugs in ``stack``, ``get_dummies``, ``make_axis_dummies`` which don't preserve categorical dtypes in (multi)indexes (:issue:`13854`) | |||
- Bug in ``internals._try_coerce_args``, when setting ```Timedelta``` with ```ix``` (:issue:`14155`) |
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 you make this clearer for the user? (specify the user-visible effect of the bug, not the underlying reason)
c8452df
to
a01e131
Compare
I have edited the |
@@ -1696,7 +1696,7 @@ def _try_coerce_args(self, values, other): | |||
other = other.value | |||
elif isinstance(other, np.timedelta64): | |||
other_mask = isnull(other) | |||
other = other.view('i8') | |||
other = Timedelta(np.timedelta64(other)).value |
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.
Timesdelta(other).value
is idiomatic; other
is already a np.timedelta64
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.
Oops, yep of course. Fixed.
minor comments. lgtm. ping on green. |
a01e131
to
6ccc766
Compare
@jreback , looks like all checks have passed. Let me know if there is anything else I can do. |
@rsmith54 Maybe something went wrong with committing the changes, but it seems the |
6ccc766
to
dce11f0
Compare
lgtm. |
thanks! |
git diff upstream/master | flake8 --diff