File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -8665,11 +8665,10 @@ def _reduce(
86658665 assert filter_type is None or filter_type == "bool" , filter_type
86668666 out_dtype = "bool" if filter_type == "bool" else None
86678667
8668+ own_dtypes = [arr .dtype for arr in self ._iter_column_arrays ()]
8669+
86688670 dtype_is_dt = np .array (
8669- [
8670- is_datetime64_any_dtype (values .dtype )
8671- for values in self ._iter_column_arrays ()
8672- ],
8671+ [is_datetime64_any_dtype (dtype ) for dtype in own_dtypes ],
86738672 dtype = bool ,
86748673 )
86758674 if numeric_only is None and name in ["mean" , "median" ] and dtype_is_dt .any ():
@@ -8683,7 +8682,11 @@ def _reduce(
86838682 cols = self .columns [~ dtype_is_dt ]
86848683 self = self [cols ]
86858684
8686- any_object = self .dtypes .apply (is_object_dtype ).any ()
8685+ any_object = np .array (
8686+ [is_object_dtype (dtype ) for dtype in own_dtypes ],
8687+ dtype = bool ,
8688+ ).any ()
8689+
86878690 # TODO: Make other agg func handle axis=None properly GH#21597
86888691 axis = self ._get_axis_number (axis )
86898692 labels = self ._get_agg_axis (axis )
You can’t perform that action at this time.
0 commit comments