Skip to content

Commit 0914808

Browse files
authored
PERF: GroupBy.apply (pandas-dev#43578)
1 parent 95eb153 commit 0914808

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pandas/core/groupby/groupby.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -1013,11 +1013,12 @@ def reset_identity(values):
10131013

10141014
if not not_indexed_same:
10151015
result = concat(values, axis=self.axis)
1016-
ax = (
1017-
self.filter(lambda x: True).axes[self.axis]
1018-
if self.dropna
1019-
else self._selected_obj._get_axis(self.axis)
1020-
)
1016+
1017+
ax = self._selected_obj._get_axis(self.axis)
1018+
if self.dropna:
1019+
labels = self.grouper.group_info[0]
1020+
mask = labels != -1
1021+
ax = ax[mask]
10211022

10221023
# this is a very unfortunate situation
10231024
# we can't use reindex to restore the original order

0 commit comments

Comments
 (0)