123
123
is_object_dtype ,
124
124
is_scalar ,
125
125
is_sequence ,
126
- is_timedelta64_dtype ,
127
126
needs_i8_conversion ,
128
127
pandas_dtype ,
129
128
)
@@ -10526,7 +10525,7 @@ def quantile(
10526
10525
self ,
10527
10526
q = 0.5 ,
10528
10527
axis : Axis = 0 ,
10529
- numeric_only : bool = True ,
10528
+ numeric_only : bool | lib . NoDefault = no_default ,
10530
10529
interpolation : str = "linear" ,
10531
10530
):
10532
10531
"""
@@ -10597,6 +10596,17 @@ def quantile(
10597
10596
validate_percentile (q )
10598
10597
axis = self ._get_axis_number (axis )
10599
10598
10599
+ if numeric_only is no_default :
10600
+ warnings .warn (
10601
+ "In future versions of pandas, numeric_only will be set to "
10602
+ "False by default, and the datetime/timedelta columns will "
10603
+ "be considered in the results. To not consider these columns"
10604
+ "specify numeric_only=True and ignore this warning." ,
10605
+ FutureWarning ,
10606
+ stacklevel = find_stack_level (),
10607
+ )
10608
+ numeric_only = True
10609
+
10600
10610
if not is_list_like (q ):
10601
10611
# BlockManager.quantile expects listlike, so we wrap and unwrap here
10602
10612
res_df = self .quantile (
@@ -10610,19 +10620,6 @@ def quantile(
10610
10620
return res .astype (dtype )
10611
10621
return res
10612
10622
10613
- has_any_datetime_or_timestamp = any (
10614
- is_datetime64_any_dtype (x ) or is_timedelta64_dtype (x ) for x in self .dtypes
10615
- )
10616
- if numeric_only and has_any_datetime_or_timestamp :
10617
- warnings .warn (
10618
- "In future versions of pandas, numeric_only will be set to "
10619
- "False by default, and the datetime/timedelta columns will "
10620
- "be considered in the results. To not consider these columns"
10621
- "specify numeric_only=True and ignore this warning." ,
10622
- FutureWarning ,
10623
- stacklevel = find_stack_level (),
10624
- )
10625
-
10626
10623
q = Index (q , dtype = np .float64 )
10627
10624
data = self ._get_numeric_data () if numeric_only else self
10628
10625
0 commit comments