132
132
is_integer_dtype ,
133
133
is_iterator ,
134
134
is_list_like ,
135
- is_numeric_dtype ,
136
135
is_object_dtype ,
137
136
is_scalar ,
138
137
is_sequence ,
@@ -9938,7 +9937,7 @@ def corr(
9938
9937
self ,
9939
9938
method : CorrelationMethod = "pearson" ,
9940
9939
min_periods : int = 1 ,
9941
- numeric_only : bool | lib . NoDefault = lib . no_default ,
9940
+ numeric_only : bool = False ,
9942
9941
) -> DataFrame :
9943
9942
"""
9944
9943
Compute pairwise correlation of columns, excluding NA/null values.
@@ -9959,14 +9958,13 @@ def corr(
9959
9958
Minimum number of observations required per pair of columns
9960
9959
to have a valid result. Currently only available for Pearson
9961
9960
and Spearman correlation.
9962
- numeric_only : bool, default True
9961
+ numeric_only : bool, default False
9963
9962
Include only `float`, `int` or `boolean` data.
9964
9963
9965
9964
.. versionadded:: 1.5.0
9966
9965
9967
- .. deprecated:: 1.5.0
9968
- The default value of ``numeric_only`` will be ``False`` in a future
9969
- version of pandas.
9966
+ .. versionchanged:: 2.0.0
9967
+ The default value of ``numeric_only`` is now ``False``.
9970
9968
9971
9969
Returns
9972
9970
-------
@@ -10006,11 +10004,7 @@ def corr(
10006
10004
dogs 1.0 NaN
10007
10005
cats NaN 1.0
10008
10006
""" # noqa:E501
10009
- numeric_only_bool = com .resolve_numeric_only (numeric_only )
10010
- data = self ._get_numeric_data () if numeric_only_bool else self
10011
- if numeric_only is lib .no_default and len (data .columns ) < len (self .columns ):
10012
- com .deprecate_numeric_only_default (type (self ), "corr" )
10013
-
10007
+ data = self ._get_numeric_data () if numeric_only else self
10014
10008
cols = data .columns
10015
10009
idx = cols .copy ()
10016
10010
mat = data .to_numpy (dtype = float , na_value = np .nan , copy = False )
@@ -10057,7 +10051,7 @@ def cov(
10057
10051
self ,
10058
10052
min_periods : int | None = None ,
10059
10053
ddof : int | None = 1 ,
10060
- numeric_only : bool | lib . NoDefault = lib . no_default ,
10054
+ numeric_only : bool = False ,
10061
10055
) -> DataFrame :
10062
10056
"""
10063
10057
Compute pairwise covariance of columns, excluding NA/null values.
@@ -10089,14 +10083,13 @@ def cov(
10089
10083
10090
10084
.. versionadded:: 1.1.0
10091
10085
10092
- numeric_only : bool, default True
10086
+ numeric_only : bool, default False
10093
10087
Include only `float`, `int` or `boolean` data.
10094
10088
10095
10089
.. versionadded:: 1.5.0
10096
10090
10097
- .. deprecated:: 1.5.0
10098
- The default value of ``numeric_only`` will be ``False`` in a future
10099
- version of pandas.
10091
+ .. versionchanged:: 2.0.0
10092
+ The default value of ``numeric_only`` is now ``False``.
10100
10093
10101
10094
Returns
10102
10095
-------
@@ -10167,11 +10160,7 @@ def cov(
10167
10160
b NaN 1.248003 0.191417
10168
10161
c -0.150812 0.191417 0.895202
10169
10162
"""
10170
- numeric_only_bool = com .resolve_numeric_only (numeric_only )
10171
- data = self ._get_numeric_data () if numeric_only_bool else self
10172
- if numeric_only is lib .no_default and len (data .columns ) < len (self .columns ):
10173
- com .deprecate_numeric_only_default (type (self ), "cov" )
10174
-
10163
+ data = self ._get_numeric_data () if numeric_only else self
10175
10164
cols = data .columns
10176
10165
idx = cols .copy ()
10177
10166
mat = data .to_numpy (dtype = float , na_value = np .nan , copy = False )
@@ -10195,7 +10184,7 @@ def corrwith(
10195
10184
axis : Axis = 0 ,
10196
10185
drop : bool = False ,
10197
10186
method : CorrelationMethod = "pearson" ,
10198
- numeric_only : bool | lib . NoDefault = lib . no_default ,
10187
+ numeric_only : bool = False ,
10199
10188
) -> Series :
10200
10189
"""
10201
10190
Compute pairwise correlation.
@@ -10223,14 +10212,13 @@ def corrwith(
10223
10212
* callable: callable with input two 1d ndarrays
10224
10213
and returning a float.
10225
10214
10226
- numeric_only : bool, default True
10215
+ numeric_only : bool, default False
10227
10216
Include only `float`, `int` or `boolean` data.
10228
10217
10229
10218
.. versionadded:: 1.5.0
10230
10219
10231
- .. deprecated:: 1.5.0
10232
- The default value of ``numeric_only`` will be ``False`` in a future
10233
- version of pandas.
10220
+ .. versionchanged:: 2.0.0
10221
+ The default value of ``numeric_only`` is now ``False``.
10234
10222
10235
10223
Returns
10236
10224
-------
@@ -10263,15 +10251,12 @@ def corrwith(
10263
10251
dtype: float64
10264
10252
""" # noqa:E501
10265
10253
axis = self ._get_axis_number (axis )
10266
- numeric_only_bool = com .resolve_numeric_only (numeric_only )
10267
- this = self ._get_numeric_data () if numeric_only_bool else self
10268
- if numeric_only is lib .no_default and len (this .columns ) < len (self .columns ):
10269
- com .deprecate_numeric_only_default (type (self ), "corrwith" )
10254
+ this = self ._get_numeric_data () if numeric_only else self
10270
10255
10271
10256
if isinstance (other , Series ):
10272
10257
return this .apply (lambda x : other .corr (x , method = method ), axis = axis )
10273
10258
10274
- if numeric_only_bool :
10259
+ if numeric_only :
10275
10260
other = other ._get_numeric_data ()
10276
10261
left , right = this .align (other , join = "inner" , copy = False )
10277
10262
@@ -10285,14 +10270,14 @@ def corrwith(
10285
10270
right = right + left * 0
10286
10271
10287
10272
# demeaned data
10288
- ldem = left - left .mean (numeric_only = numeric_only_bool )
10289
- rdem = right - right .mean (numeric_only = numeric_only_bool )
10273
+ ldem = left - left .mean (numeric_only = numeric_only )
10274
+ rdem = right - right .mean (numeric_only = numeric_only )
10290
10275
10291
10276
num = (ldem * rdem ).sum ()
10292
10277
dom = (
10293
10278
(left .count () - 1 )
10294
- * left .std (numeric_only = numeric_only_bool )
10295
- * right .std (numeric_only = numeric_only_bool )
10279
+ * left .std (numeric_only = numeric_only )
10280
+ * right .std (numeric_only = numeric_only )
10296
10281
)
10297
10282
10298
10283
correl = num / dom
@@ -10484,12 +10469,6 @@ def _get_data() -> DataFrame:
10484
10469
# float64, see test_apply_funcs_over_empty
10485
10470
out = out .astype (np .float64 )
10486
10471
10487
- if numeric_only is None and out .shape [0 ] != df .shape [1 ]:
10488
- # columns have been dropped GH#41480
10489
- com .deprecate_numeric_only_default (
10490
- type (self ), name , deprecate_none = True
10491
- )
10492
-
10493
10472
return out
10494
10473
10495
10474
assert not numeric_only and axis == 1
@@ -10739,7 +10718,7 @@ def quantile(
10739
10718
self ,
10740
10719
q : float = ...,
10741
10720
axis : Axis = ...,
10742
- numeric_only : bool | lib . NoDefault = ...,
10721
+ numeric_only : bool = ...,
10743
10722
interpolation : QuantileInterpolation = ...,
10744
10723
) -> Series :
10745
10724
...
@@ -10749,7 +10728,7 @@ def quantile(
10749
10728
self ,
10750
10729
q : AnyArrayLike | Sequence [float ],
10751
10730
axis : Axis = ...,
10752
- numeric_only : bool | lib . NoDefault = ...,
10731
+ numeric_only : bool = ...,
10753
10732
interpolation : QuantileInterpolation = ...,
10754
10733
) -> Series | DataFrame :
10755
10734
...
@@ -10759,7 +10738,7 @@ def quantile(
10759
10738
self ,
10760
10739
q : float | AnyArrayLike | Sequence [float ] = ...,
10761
10740
axis : Axis = ...,
10762
- numeric_only : bool | lib . NoDefault = ...,
10741
+ numeric_only : bool = ...,
10763
10742
interpolation : QuantileInterpolation = ...,
10764
10743
) -> Series | DataFrame :
10765
10744
...
@@ -10768,7 +10747,7 @@ def quantile(
10768
10747
self ,
10769
10748
q : float | AnyArrayLike | Sequence [float ] = 0.5 ,
10770
10749
axis : Axis = 0 ,
10771
- numeric_only : bool | lib . NoDefault = no_default ,
10750
+ numeric_only : bool = False ,
10772
10751
interpolation : QuantileInterpolation = "linear" ,
10773
10752
method : Literal ["single" , "table" ] = "single" ,
10774
10753
) -> Series | DataFrame :
@@ -10781,13 +10760,11 @@ def quantile(
10781
10760
Value between 0 <= q <= 1, the quantile(s) to compute.
10782
10761
axis : {0 or 'index', 1 or 'columns'}, default 0
10783
10762
Equals 0 or 'index' for row-wise, 1 or 'columns' for column-wise.
10784
- numeric_only : bool, default True
10785
- If False, the quantile of datetime and timedelta data will be
10786
- computed as well.
10763
+ numeric_only : bool, default False
10764
+ Include only `float`, `int` or `boolean` data.
10787
10765
10788
- .. deprecated:: 1.5.0
10789
- The default value of ``numeric_only`` will be ``False`` in a future
10790
- version of pandas.
10766
+ .. versionchanged:: 2.0.0
10767
+ The default value of ``numeric_only`` is now ``False``.
10791
10768
10792
10769
interpolation : {'linear', 'lower', 'higher', 'midpoint', 'nearest'}
10793
10770
This optional parameter specifies the interpolation method to use,
@@ -10859,10 +10836,6 @@ def quantile(
10859
10836
"""
10860
10837
validate_percentile (q )
10861
10838
axis = self ._get_axis_number (axis )
10862
- any_not_numeric = any (not is_numeric_dtype (x ) for x in self .dtypes )
10863
- if numeric_only is no_default and any_not_numeric :
10864
- com .deprecate_numeric_only_default (type (self ), "quantile" )
10865
- numeric_only = com .resolve_numeric_only (numeric_only )
10866
10839
10867
10840
if not is_list_like (q ):
10868
10841
# BlockManager.quantile expects listlike, so we wrap and unwrap here
0 commit comments