-
-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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/TST: non-numeric EA reductions #59234
BUG/TST: non-numeric EA reductions #59234
Conversation
pandas/core/arrays/string_.py
Outdated
@@ -525,7 +525,10 @@ def _reduce( | |||
self, name: str, *, skipna: bool = True, axis: AxisInt | None = 0, **kwargs | |||
): | |||
if name in ["min", "max"]: | |||
return getattr(self, name)(skipna=skipna, axis=axis) | |||
result = getattr(self, name)(skipna=skipna, axis=axis) | |||
if kwargs.get("keepdims"): |
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 include keepdims
in the _reduce
signature instead?
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.
updated
if name == "std": | ||
from pandas.core.arrays import TimedeltaArray | ||
|
||
return TimedeltaArray._from_sequence(result) |
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.
Does this possibly preserve the resolution of the input? e.g std of a ms resolution datetime array should return ms resolution
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, the resolution is preserved in nanops.nanstd
.
Thanks @lukemanley |
doc/source/whatsnew/v3.0.0.rst
file if fixing a bug or adding a new feature.Fixes a few bugs related to non-numeric EA reductions and expands testing by un-skipping a number of existing tests.
BUG fix example: