File tree 2 files changed +10
-2
lines changed
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -9810,8 +9810,12 @@ def _reduce(
9810
9810
FutureWarning ,
9811
9811
stacklevel = 5 ,
9812
9812
)
9813
- cols = self .columns [~ dtype_is_dt ]
9814
- self = self [cols ]
9813
+ # Non-copy equivalent to
9814
+ # cols = self.columns[~dtype_is_dt]
9815
+ # self = self[cols]
9816
+ predicate = lambda x : not is_datetime64_any_dtype (x .dtype )
9817
+ mgr = self ._mgr ._get_data_subset (predicate )
9818
+ self = type (self )(mgr )
9815
9819
9816
9820
# TODO: Make other agg func handle axis=None properly GH#21597
9817
9821
axis = self ._get_axis_number (axis )
Original file line number Diff line number Diff line change @@ -479,6 +479,10 @@ def is_view(self) -> bool:
479
479
480
480
return False
481
481
482
+ def _get_data_subset (self : T , predicate : Callable ) -> T :
483
+ blocks = [blk for blk in self .blocks if predicate (blk .values )]
484
+ return self ._combine (blocks , copy = False )
485
+
482
486
def get_bool_data (self : T , copy : bool = False ) -> T :
483
487
"""
484
488
Select blocks that are bool-dtype and columns from object-dtype blocks
You can’t perform that action at this time.
0 commit comments