Bug: Reenable test_stats_on_non_numeric_columns_should_be_discarded_if_numeric_only_is_true
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 25/May/21 08:20
Affects Version/s: 3.2.0

{code}
2021-05-25T05:42:35.2059710Z ======================================================================
2021-05-25T05:42:35.2060715Z ERROR [7.616s]: test_stats_on_non_numeric_columns_should_be_discarded_if_numeric_only_is_true (pyspark.pandas.tests.test_stats.StatsTest)
2021-05-25T05:42:35.2062263Z ----------------------------------------------------------------------
2021-05-25T05:42:35.2062956Z Traceback (most recent call last):
2021-05-25T05:42:35.2082878Z   File "/__w/spark/spark/python/pyspark/pandas/tests/test_stats.py", line 380, in test_stats_on_non_numeric_columns_should_be_discarded_if_numeric_only_is_true
2021-05-25T05:42:35.2084367Z     len(pdf.quantile(q=0.5, numeric_only=True)),
2021-05-25T05:42:35.2085868Z   File "/__t/Python/3.9.5/x64/lib/python3.9/site-packages/pandas/core/frame.py", line 9266, in quantile
2021-05-25T05:42:35.2086711Z     result = data._mgr.quantile(
2021-05-25T05:42:35.2087937Z   File "/__t/Python/3.9.5/x64/lib/python3.9/site-packages/pandas/core/internals/managers.py", line 491, in quantile
2021-05-25T05:42:35.2088996Z     block = b.quantile(axis=axis, qs=qs, interpolation=interpolation)
2021-05-25T05:42:35.2090354Z   File "/__t/Python/3.9.5/x64/lib/python3.9/site-packages/pandas/core/internals/blocks.py", line 1592, in quantile
2021-05-25T05:42:35.2091219Z     result = nanpercentile(
2021-05-25T05:42:35.2092379Z   File "/__t/Python/3.9.5/x64/lib/python3.9/site-packages/pandas/core/nanops.py", line 1675, in nanpercentile
2021-05-25T05:42:35.2093482Z     return np.percentile(values, q, axis=axis, interpolation=interpolation)
2021-05-25T05:42:35.2094410Z   File "<__array_function__ internals>", line 5, in percentile
2021-05-25T05:42:35.2095684Z   File "/__t/Python/3.9.5/x64/lib/python3.9/site-packages/numpy/lib/function_base.py", line 3818, in percentile
2021-05-25T05:42:35.2096540Z     return _quantile_unchecked(
2021-05-25T05:42:35.2097721Z   File "/__t/Python/3.9.5/x64/lib/python3.9/site-packages/numpy/lib/function_base.py", line 3937, in _quantile_unchecked
2021-05-25T05:42:35.2098827Z     r, k = _ureduce(a, func=_quantile_ureduce_func, q=q, axis=axis, out=out,
2021-05-25T05:42:35.2100098Z   File "/__t/Python/3.9.5/x64/lib/python3.9/site-packages/numpy/lib/function_base.py", line 3515, in _ureduce
2021-05-25T05:42:35.2100857Z     r = func(a, **kwargs)
2021-05-25T05:42:35.2102077Z   File "/__t/Python/3.9.5/x64/lib/python3.9/site-packages/numpy/lib/function_base.py", line 4064, in _quantile_ureduce_func
2021-05-25T05:42:35.2103034Z     r = _lerp(x_below, x_above, weights_above, out=out)
2021-05-25T05:42:35.2104209Z   File "/__t/Python/3.9.5/x64/lib/python3.9/site-packages/numpy/lib/function_base.py", line 3961, in _lerp
2021-05-25T05:42:35.2104999Z     diff_b_a = subtract(b, a)
2021-05-25T05:42:35.2106235Z TypeError: numpy boolean subtract, the `-` operator, is not supported, use the bitwise_xor, the `^` operator, or the logical_xor function instead.
2021-05-25T05:42:35.2107019Z 
2021-05-25T05:42:35.2107791Z ----------------------------------------------------------------------
2021-05-25T05:42:35.2108402Z Ran 13 tests in 147.392s
{code}

https://pipelines.actions.githubusercontent.com/gik0C3if0ep5i8iNpgFlcJRQk9UyifmoD6XvJANMVttkEP5xje/_apis/pipelines/1/runs/5500/signedlogcontent/19?urlExpires=2021-05-25T08%3A17%3A18.4581488Z&urlSigningMethod=HMACV1&urlSignature=O8Hok8Gbkayl7CIiLGTf2hxeVxnsyFm4DGWBLpTI%2BUc%3D

It fails with Python 3.9 for an unknown reason. We should investigate why and fix.