From 4fb6ae6d0be013ffd3e2b1ba7caf41b44a65dc8d Mon Sep 17 00:00:00 2001 From: Brock Date: Wed, 9 Dec 2020 17:29:37 -0800 Subject: [PATCH 1/3] BUG: algos.rank with readonly values --- pandas/_libs/algos.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_libs/algos.pyx b/pandas/_libs/algos.pyx index 734b3d5c09cbf..83e85df2a28af 100644 --- a/pandas/_libs/algos.pyx +++ b/pandas/_libs/algos.pyx @@ -824,7 +824,7 @@ def rank_1d( if values.dtype != np.object_: values = values.astype('O') else: - values = np.asarray(in_arr) + values = np.asarray(in_arr).copy() keep_na = na_option == 'keep' From e04ae88b657257c75078e6654e932b468d97a14a Mon Sep 17 00:00:00 2001 From: Brock Date: Wed, 9 Dec 2020 17:45:43 -0800 Subject: [PATCH 2/3] Fix test_show_versions --- pandas/tests/util/test_show_versions.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/tests/util/test_show_versions.py b/pandas/tests/util/test_show_versions.py index 4ea3ebe5000ad..b6a16d027db77 100644 --- a/pandas/tests/util/test_show_versions.py +++ b/pandas/tests/util/test_show_versions.py @@ -39,7 +39,8 @@ def test_show_versions(capsys): assert re.search(r"commit\s*:\s[0-9a-f]{40}\n", result) # check required dependency - assert re.search(r"numpy\s*:\s([0-9\.\+a-f\_]|dev)+\n", result) + # 2020-12-09 npdev has "dirty" in the tag + assert re.search(r"numpy\s*:\s([0-9\.\+a-g\_]|dev)+(dirty)?\n", result) # check optional dependency assert re.search(r"pyarrow\s*:\s([0-9\.]+|None)\n", result) From b6f11516f738f2f6c790aed035cf38422e66e338 Mon Sep 17 00:00:00 2001 From: Brock Date: Thu, 10 Dec 2020 08:26:35 -0800 Subject: [PATCH 3/3] remove redundant copy --- pandas/_libs/algos.pyx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pandas/_libs/algos.pyx b/pandas/_libs/algos.pyx index 83e85df2a28af..4cddd49381a83 100644 --- a/pandas/_libs/algos.pyx +++ b/pandas/_libs/algos.pyx @@ -835,11 +835,6 @@ def rank_1d( elif rank_t is int64_t: mask = values == NPY_NAT - # create copy in case of NPY_NAT - # values are mutated inplace - if mask.any(): - values = values.copy() - # double sort first by mask and then by values to ensure nan values are # either at the beginning or the end. mask/(~mask) controls padding at # tail or the head