Skip to content

Commit ded50fd

Browse files
jbrockmendeljreback
authored andcommitted
REF: remove unnecessary _try_cast calls (pandas-dev#29642)
1 parent 4ab6ee2 commit ded50fd

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

pandas/core/groupby/generic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ def _aggregate_named(self, func, *args, **kwargs):
397397
output = func(group, *args, **kwargs)
398398
if isinstance(output, (Series, Index, np.ndarray)):
399399
raise ValueError("Must produce aggregated value")
400-
result[name] = self._try_cast(output, group)
400+
result[name] = output
401401

402402
return result
403403

pandas/core/groupby/groupby.py

-8
Original file line numberDiff line numberDiff line change
@@ -1357,14 +1357,6 @@ def f(self, **kwargs):
13571357

13581358
# apply a non-cython aggregation
13591359
result = self.aggregate(lambda x: npfunc(x, axis=self.axis))
1360-
1361-
# coerce the resulting columns if we can
1362-
if isinstance(result, DataFrame):
1363-
for col in result.columns:
1364-
result[col] = self._try_cast(result[col], self.obj[col])
1365-
else:
1366-
result = self._try_cast(result, self.obj)
1367-
13681360
return result
13691361

13701362
set_function_name(f, name, cls)

0 commit comments

Comments
 (0)