-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CLN: preempt TypeError for EAs in groupby agg_series #29186
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
ok thanks |
@@ -717,6 +726,7 @@ def _aggregate_series_pure_python(self, obj, func): | |||
result[label] = res | |||
|
|||
result = lib.maybe_convert_objects(result, try_float=0) | |||
# TODO: try_cast back to EA? |
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.
This is done in the code calling this (via agg_series
):
pandas/pandas/core/groupby/groupby.py
Lines 899 to 905 in 82df98a
for name, obj in self._iterate_slices(): | |
try: | |
result, counts = self.grouper.agg_series(obj, f) | |
except TypeError: | |
continue | |
else: | |
output[name] = self._try_cast(result, obj, numeric_only=True) |
if is_extension_array_dtype(obj.dtype) and obj.dtype.kind != "M": | ||
# _aggregate_series_fast would raise TypeError when | ||
# calling libreduction.Slider | ||
# TODO: is the datetime64tz case supposed to go through 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.
Do you know why it is working for datetimes?
xref #29144