Skip to content

Commit 6bd8488

Browse files
committed
fixups
1 parent 1215dfb commit 6bd8488

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

pandas/core/groupby/generic.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -888,9 +888,8 @@ def aggregate(self, func=None, *args, engine=None, engine_kwargs=None, **kwargs)
888888
relabeling, func, columns, order, _ = reconstruct_func(func, **kwargs)
889889
func = maybe_mangle_lambdas(func)
890890

891-
with group_selection_context(self):
892-
op = GroupByApply(self, func, args, kwargs)
893-
result = op.agg()
891+
op = GroupByApply(self, func, args, kwargs)
892+
result = op.agg()
894893
if not is_dict_like(func) and result is not None:
895894
return result
896895
elif relabeling and result is not None:
@@ -937,8 +936,6 @@ def aggregate(self, func=None, *args, engine=None, engine_kwargs=None, **kwargs)
937936
gba = GroupByApply(self, [func], args=(), kwargs={})
938937
try:
939938
result = gba.agg()
940-
if get_option("new_udf_methods") and result is None:
941-
result = self._aggregate_frame(func)
942939

943940
except ValueError as err:
944941
if "no results" not in str(err):
@@ -960,8 +957,7 @@ def aggregate(self, func=None, *args, engine=None, engine_kwargs=None, **kwargs)
960957
)
961958
# select everything except for the last level, which is the
962959
# one containing the name of the function(s), see GH#32040
963-
if not get_option("new_udf_methods"):
964-
result.columns = result.columns.droplevel(-1)
960+
result.columns = result.columns.droplevel(-1)
965961

966962
if not self.as_index:
967963
self._insert_inaxis_grouper_inplace(result)

0 commit comments

Comments
 (0)