Skip to content

Commit c4259aa

Browse files
committed
Added test and documentation for qcut Float64DType support
1 parent b1fb854 commit c4259aa

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

doc/source/whatsnew/v1.3.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ Conversion
663663
- Bug in :class:`Index` construction silently ignoring a passed ``dtype`` when the data cannot be cast to that dtype (:issue:`21311`)
664664
- Bug in :meth:`StringArray.astype` falling back to numpy and raising when converting to ``dtype='categorical'`` (:issue:`40450`)
665665
- Bug in :class:`DataFrame` construction with a dictionary containing an arraylike with ``ExtensionDtype`` and ``copy=True`` failing to make a copy (:issue:`38939`)
666-
-
666+
- Bug in :func:`_coerce_to_type` failing to convert ``Float64DType`` input into numpy array (:issue:`40730`)
667667

668668
Strings
669669
^^^^^^^

pandas/tests/reshape/test_qcut.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,3 +301,19 @@ def test_qcut_nullable_integer(q, any_nullable_int_dtype):
301301
expected = qcut(arr.astype(float), q)
302302

303303
tm.assert_categorical_equal(result, expected)
304+
305+
306+
@pytest.mark.parametrize("Data_type,Data_type_string",
307+
[
308+
(pd.Float64Dtype(),"Float64Dtype"),
309+
(pd.Int64Dtype(),"Int64Dtype")
310+
]
311+
)
312+
def test_qcut_numeric_dtype(Data_type,Data_type_string):
313+
series = pd.Series([1.0, 2.0, 3.0, 4.0], dtype=Data_type)
314+
315+
try:
316+
pd.qcut(series,2)
317+
except:
318+
Fail_string=Data_type_string+" is not supported"
319+
pytest.fail(msg=Fail_string )

0 commit comments

Comments
 (0)