@@ -158,7 +158,7 @@ def _wrap_agged_manager(self, mgr: Manager) -> Series:
158
158
def _get_data_to_aggregate (
159
159
self , * , numeric_only : bool = False , name : str | None = None
160
160
) -> SingleManager :
161
- ser = self ._selected_obj
161
+ ser = self ._obj_with_exclusions
162
162
single = ser ._mgr
163
163
if numeric_only and not is_numeric_dtype (ser .dtype ):
164
164
# GH#41291 match Series behavior
@@ -448,7 +448,7 @@ def _aggregate_named(self, func, *args, **kwargs):
448
448
initialized = False
449
449
450
450
for name , group in self .grouper .get_iterator (
451
- self ._selected_obj , axis = self .axis
451
+ self ._obj_with_exclusions , axis = self .axis
452
452
):
453
453
# needed for pandas/tests/groupby/test_groupby.py::test_basic_aggregations
454
454
object .__setattr__ (group , "name" , name )
@@ -519,7 +519,7 @@ def _cython_transform(
519
519
):
520
520
assert axis == 0 # handled by caller
521
521
522
- obj = self ._selected_obj
522
+ obj = self ._obj_with_exclusions
523
523
524
524
try :
525
525
result = self .grouper ._cython_operation (
@@ -546,7 +546,7 @@ def _transform_general(
546
546
547
547
results = []
548
548
for name , group in self .grouper .get_iterator (
549
- self ._selected_obj , axis = self .axis
549
+ self ._obj_with_exclusions , axis = self .axis
550
550
):
551
551
# this setattr is needed for test_transform_lambda_with_datetimetz
552
552
object .__setattr__ (group , "name" , name )
@@ -618,7 +618,7 @@ def true_and_notna(x) -> bool:
618
618
indices = [
619
619
self ._get_index (name )
620
620
for name , group in self .grouper .get_iterator (
621
- self ._selected_obj , axis = self .axis
621
+ self ._obj_with_exclusions , axis = self .axis
622
622
)
623
623
if true_and_notna (group )
624
624
]
@@ -1164,7 +1164,7 @@ def nlargest(
1164
1164
self , n : int = 5 , keep : Literal ["first" , "last" , "all" ] = "first"
1165
1165
) -> Series :
1166
1166
f = partial (Series .nlargest , n = n , keep = keep )
1167
- data = self ._selected_obj
1167
+ data = self ._obj_with_exclusions
1168
1168
# Don't change behavior if result index happens to be the same, i.e.
1169
1169
# already ordered and n >= all group sizes.
1170
1170
result = self ._python_apply_general (f , data , not_indexed_same = True )
@@ -1175,7 +1175,7 @@ def nsmallest(
1175
1175
self , n : int = 5 , keep : Literal ["first" , "last" , "all" ] = "first"
1176
1176
) -> Series :
1177
1177
f = partial (Series .nsmallest , n = n , keep = keep )
1178
- data = self ._selected_obj
1178
+ data = self ._obj_with_exclusions
1179
1179
# Don't change behavior if result index happens to be the same, i.e.
1180
1180
# already ordered and n >= all group sizes.
1181
1181
result = self ._python_apply_general (f , data , not_indexed_same = True )
0 commit comments