Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pandas/core/groupby/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ def _aggregate_named(self, func, *args, **kwargs):
output = func(group, *args, **kwargs)
if isinstance(output, (Series, Index, np.ndarray)):
raise ValueError("Must produce aggregated value")
result[name] = self._try_cast(output, group)
result[name] = output

return result

Expand Down
8 changes: 0 additions & 8 deletions pandas/core/groupby/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -1357,14 +1357,6 @@ def f(self, **kwargs):

# apply a non-cython aggregation
result = self.aggregate(lambda x: npfunc(x, axis=self.axis))

# coerce the resulting columns if we can
if isinstance(result, DataFrame):
for col in result.columns:
result[col] = self._try_cast(result[col], self.obj[col])
else:
result = self._try_cast(result, self.obj)

return result

set_function_name(f, name, cls)
Expand Down