From 20c7919612fee2d3db03c6fd16cd53e25da70fd5 Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Sun, 8 Jul 2018 16:14:24 +0200 Subject: [PATCH] Add unit test for #12813 (#21811) --- doc/source/whatsnew/v0.24.0.txt | 1 + pandas/tests/test_algos.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v0.24.0.txt b/doc/source/whatsnew/v0.24.0.txt index 29c1a68053aef8..be5b8f9ba93ac4 100644 --- a/doc/source/whatsnew/v0.24.0.txt +++ b/doc/source/whatsnew/v0.24.0.txt @@ -331,6 +331,7 @@ Numeric ^^^^^^^ - Bug in :class:`Series` ``__rmatmul__`` doesn't support matrix vector multiplication (:issue:`21530`) +- Bug in :func:`factorize` fails with read-only array (:issue:`12813`) - - diff --git a/pandas/tests/test_algos.py b/pandas/tests/test_algos.py index de3c9574a4471b..25e64aa82cc361 100644 --- a/pandas/tests/test_algos.py +++ b/pandas/tests/test_algos.py @@ -231,8 +231,9 @@ def test_complex_sorting(self): pytest.raises(TypeError, algos.factorize, x17[::-1], sort=True) - def test_uint64_factorize(self): + def test_uint64_factorize(self, writable): data = np.array([2**63, 1, 2**63], dtype=np.uint64) + data.setflags(write=writable) exp_labels = np.array([0, 1, 0], dtype=np.intp) exp_uniques = np.array([2**63, 1], dtype=np.uint64)