-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Fix multiplying Timedelta Series with a pandas nullable dtype Series #58375
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
@@ -365,6 +365,7 @@ Timedelta | |||
^^^^^^^^^ | |||
- Accuracy improvement in :meth:`Timedelta.to_pytimedelta` to round microseconds consistently for large nanosecond based Timedelta (:issue:`57841`) | |||
- Bug in :meth:`DataFrame.cumsum` which was raising ``IndexError`` if dtype is ``timedelta64[ns]`` (:issue:`57956`) | |||
- Bug in :meth:`TimedeltaArray._simple_new` which was raising ``AssertionError`` When multiplying a Series with a timedelta64 dtype with another Series that uses any of the pandas nullable dtypes ``('Int8', 'Int16', 'Int32', 'Int64', 'UInt8', 'UInt16', 'UInt32', 'UInt64', 'Float32', 'Float64', or 'boolean')`` (:issue:`58054`) |
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.
don't reference _simple_new or even TimedeltaArray, just the relevant dtypes in Series/DataFrame
@@ -492,6 +494,16 @@ def __mul__(self, other) -> Self: | |||
result = np.array(result) | |||
return type(self)._simple_new(result, dtype=result.dtype) | |||
|
|||
if is_bool_dtype(other.dtype) or is_numeric_dtype(other.dtype): |
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.
instead of doing this here, check for BaseMaskedArray and return NotImplemented
td_series = Series([timedelta(hours=1)]) | ||
other = Series([True]) | ||
|
||
pandas_types = [ |
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 a fixture or pytest.mark.parametrize
Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen. |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.Tests were added, but raise an error. Does anyone know how to fix it?
This is my first pull request, please let me know if I need to change anything :)