File tree 1 file changed +8
-5
lines changed
1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -8665,11 +8665,10 @@ def _reduce(
8665
8665
assert filter_type is None or filter_type == "bool" , filter_type
8666
8666
out_dtype = "bool" if filter_type == "bool" else None
8667
8667
8668
+ own_dtypes = [arr .dtype for arr in self ._iter_column_arrays ()]
8669
+
8668
8670
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 ],
8673
8672
dtype = bool ,
8674
8673
)
8675
8674
if numeric_only is None and name in ["mean" , "median" ] and dtype_is_dt .any ():
@@ -8683,7 +8682,11 @@ def _reduce(
8683
8682
cols = self .columns [~ dtype_is_dt ]
8684
8683
self = self [cols ]
8685
8684
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
+
8687
8690
# TODO: Make other agg func handle axis=None properly GH#21597
8688
8691
axis = self ._get_axis_number (axis )
8689
8692
labels = self ._get_agg_axis (axis )
You can’t perform that action at this time.
0 commit comments