122
122
is_object_dtype ,
123
123
is_scalar ,
124
124
is_sequence ,
125
- is_timedelta64_dtype ,
126
125
needs_i8_conversion ,
127
126
pandas_dtype ,
128
127
)
@@ -10559,7 +10558,7 @@ def quantile(
10559
10558
self ,
10560
10559
q = 0.5 ,
10561
10560
axis : Axis = 0 ,
10562
- numeric_only : bool = True ,
10561
+ numeric_only : bool | lib . NoDefault = no_default ,
10563
10562
interpolation : str = "linear" ,
10564
10563
):
10565
10564
"""
@@ -10630,6 +10629,17 @@ def quantile(
10630
10629
validate_percentile (q )
10631
10630
axis = self ._get_axis_number (axis )
10632
10631
10632
+ if numeric_only is no_default :
10633
+ warnings .warn (
10634
+ "In future versions of pandas, numeric_only will be set to "
10635
+ "False by default, and the datetime/timedelta columns will "
10636
+ "be considered in the results. To not consider these columns"
10637
+ "specify numeric_only=True and ignore this warning." ,
10638
+ FutureWarning ,
10639
+ stacklevel = find_stack_level (),
10640
+ )
10641
+ numeric_only = True
10642
+
10633
10643
if not is_list_like (q ):
10634
10644
# BlockManager.quantile expects listlike, so we wrap and unwrap here
10635
10645
res_df = self .quantile (
@@ -10643,19 +10653,6 @@ def quantile(
10643
10653
return res .astype (dtype )
10644
10654
return res
10645
10655
10646
- has_any_datetime_or_timestamp = any (
10647
- is_datetime64_any_dtype (x ) or is_timedelta64_dtype (x ) for x in self .dtypes
10648
- )
10649
- if numeric_only and has_any_datetime_or_timestamp :
10650
- warnings .warn (
10651
- "In future versions of pandas, numeric_only will be set to "
10652
- "False by default, and the datetime/timedelta columns will "
10653
- "be considered in the results. To not consider these columns"
10654
- "specify numeric_only=True and ignore this warning." ,
10655
- FutureWarning ,
10656
- stacklevel = find_stack_level (),
10657
- )
10658
-
10659
10656
q = Index (q , dtype = np .float64 )
10660
10657
data = self ._get_numeric_data () if numeric_only else self
10661
10658
0 commit comments