diff --git a/doc/source/whatsnew/v0.24.0.txt b/doc/source/whatsnew/v0.24.0.txt index 29c1a68053aef..be5b8f9ba93ac 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 de3c9574a4471..25e64aa82cc36 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)