-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
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: Non unitless np NaT arithmetic with non-nano #52821
Conversation
pandas/core/ops/array_ops.py
Outdated
@@ -533,7 +538,11 @@ def maybe_prepare_scalar_for_op(obj, shape: Shape): | |||
from pandas.core.arrays import DatetimeArray | |||
|
|||
# Avoid possible ambiguities with pd.NaT | |||
obj = obj.astype("datetime64[ns]") | |||
# GH 52295 | |||
if is_unitless(obj.dtype) or not is_supported_unit( |
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.
i think in non-supported unit cases we'd want to use the closest-to-supported? could just handle the unitless case here?
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 call. We also need to handle the unsupported NaT case here too though
thx @mroeschke |
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon! Remember to remove the If these instructions are inaccurate, feel free to suggest an improvement. |
(cherry picked from commit eb9a3e8)
…ic with non-nano) (#52847) BUG: Non unitless np NaT arithmetic with non-nano (#52821) (cherry picked from commit eb9a3e8) Co-authored-by: Matthew Roeschke <[email protected]>
datetime
&timedelta
binary operations inpandas-2.0
#52295 (Replace xxxx with the GitHub issue number)doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.