Skip to content

Commit ee18cb5

Browse files
authored
Updated qcut for Float64DType Issue #40730 (#40969)
1 parent 14a581d commit ee18cb5

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

doc/source/whatsnew/v1.3.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ Conversion
707707
- Bug in :meth:`StringArray.astype` falling back to numpy and raising when converting to ``dtype='categorical'`` (:issue:`40450`)
708708
- Bug in :func:`factorize` where, when given an array with a numeric numpy dtype lower than int64, uint64 and float64, the unique values did not keep their original dtype (:issue:`41132`)
709709
- Bug in :class:`DataFrame` construction with a dictionary containing an arraylike with ``ExtensionDtype`` and ``copy=True`` failing to make a copy (:issue:`38939`)
710-
-
710+
- Bug in :meth:`qcut` raising error when taking ``Float64DType`` as input (:issue:`40730`)
711711

712712
Strings
713713
^^^^^^^

pandas/core/reshape/tile.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
is_datetime_or_timedelta_dtype,
2525
is_extension_array_dtype,
2626
is_integer,
27-
is_integer_dtype,
2827
is_list_like,
28+
is_numeric_dtype,
2929
is_scalar,
3030
is_timedelta64_dtype,
3131
)
@@ -488,7 +488,7 @@ def _coerce_to_type(x):
488488
# Will properly support in the future.
489489
# https://github.com/pandas-dev/pandas/pull/31290
490490
# https://github.com/pandas-dev/pandas/issues/31389
491-
elif is_extension_array_dtype(x.dtype) and is_integer_dtype(x.dtype):
491+
elif is_extension_array_dtype(x.dtype) and is_numeric_dtype(x.dtype):
492492
x = x.to_numpy(dtype=np.float64, na_value=np.nan)
493493

494494
if dtype is not None:

pandas/tests/reshape/test_qcut.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,8 @@ def test_qcut_bool_coercion_to_int(bins, box, compare):
293293

294294

295295
@pytest.mark.parametrize("q", [2, 5, 10])
296-
def test_qcut_nullable_integer(q, any_nullable_int_dtype):
297-
arr = pd.array(np.arange(100), dtype=any_nullable_int_dtype)
296+
def test_qcut_nullable_integer(q, any_nullable_numeric_dtype):
297+
arr = pd.array(np.arange(100), dtype=any_nullable_numeric_dtype)
298298
arr[::2] = pd.NA
299299

300300
result = qcut(arr, q)

0 commit comments

Comments
 (0)