Skip to content

Commit 1d573b3

Browse files
MarcoGorelliMarco Gorelli
authored and
Marco Gorelli
committed
simplify
1 parent b06f08f commit 1d573b3

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

pandas/core/groupby/generic.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -955,10 +955,7 @@ def aggregate(self, func=None, *args, **kwargs):
955955
raise
956956
result = self._aggregate_frame(func)
957957
else:
958-
result.columns = Index(
959-
[i[:-1] if len(i) > 2 else i[0] for i in result.columns],
960-
name=self._selected_obj.columns.name,
961-
)
958+
result.columns = result.columns.droplevel(-1)
962959

963960
if not self.as_index:
964961
self._insert_inaxis_grouper_inplace(result)

0 commit comments

Comments
 (0)