From f2d8447b35ed7221fa3d974e4c7bec2c27731e11 Mon Sep 17 00:00:00 2001 From: Brock Date: Wed, 8 Dec 2021 12:54:22 -0800 Subject: [PATCH 1/7] CI: Troubleshoot CI --- pandas/tests/arithmetic/test_timedelta64.py | 8 +++++++- pandas/tests/frame/constructors/test_from_records.py | 5 +---- pandas/tests/indexes/datetimes/test_indexing.py | 4 ---- pandas/tests/plotting/test_datetimelike.py | 7 +------ pandas/tests/reductions/test_stat_reductions.py | 4 ++-- 5 files changed, 11 insertions(+), 17 deletions(-) diff --git a/pandas/tests/arithmetic/test_timedelta64.py b/pandas/tests/arithmetic/test_timedelta64.py index 29c01e45ed28d..15ba1b1089e1c 100644 --- a/pandas/tests/arithmetic/test_timedelta64.py +++ b/pandas/tests/arithmetic/test_timedelta64.py @@ -1472,7 +1472,13 @@ def test_td64arr_mul_int(self, box_with_array): def test_td64arr_mul_tdlike_scalar_raises(self, two_hours, box_with_array): rng = timedelta_range("1 days", "10 days", name="foo") rng = tm.box_expected(rng, box_with_array) - msg = "argument must be an integer|cannot use operands with types dtype" + msg = "|".join( + [ + "argument must be an integer", + "cannot use operands with types dtype", + r"unsupported operand type(s) for \*", + ] + ) with pytest.raises(TypeError, match=msg): rng * two_hours diff --git a/pandas/tests/frame/constructors/test_from_records.py b/pandas/tests/frame/constructors/test_from_records.py index abb70089f1fef..4aa150afadef6 100644 --- a/pandas/tests/frame/constructors/test_from_records.py +++ b/pandas/tests/frame/constructors/test_from_records.py @@ -33,10 +33,7 @@ def test_from_records_with_datetimes(self): arrdata = [np.array([datetime(2005, 3, 1, 0, 0), None])] dtypes = [("EXPIRY", " Date: Wed, 8 Dec 2021 15:00:35 -0800 Subject: [PATCH 2/7] typo fixup --- pandas/tests/arithmetic/test_timedelta64.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/arithmetic/test_timedelta64.py b/pandas/tests/arithmetic/test_timedelta64.py index 15ba1b1089e1c..840426931b152 100644 --- a/pandas/tests/arithmetic/test_timedelta64.py +++ b/pandas/tests/arithmetic/test_timedelta64.py @@ -1476,7 +1476,7 @@ def test_td64arr_mul_tdlike_scalar_raises(self, two_hours, box_with_array): [ "argument must be an integer", "cannot use operands with types dtype", - r"unsupported operand type(s) for \*", + r"unsupported operand type\(s\) for \*", ] ) with pytest.raises(TypeError, match=msg): From 2c49f2ea8bc661088e9c8637b5bcc5f9782e816b Mon Sep 17 00:00:00 2001 From: Brock Date: Thu, 9 Dec 2021 08:01:47 -0800 Subject: [PATCH 3/7] revert no-longer-needed --- pandas/tests/reductions/test_stat_reductions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/tests/reductions/test_stat_reductions.py b/pandas/tests/reductions/test_stat_reductions.py index 0b9a7eca951f5..0d1bb05c27564 100644 --- a/pandas/tests/reductions/test_stat_reductions.py +++ b/pandas/tests/reductions/test_stat_reductions.py @@ -74,8 +74,8 @@ def test_td64_mean(self, box): obj = box(tdarr) result = obj.mean() - np_tda = np.array(tdarr) - assert result == np_tda.mean() + expected = np.array(tdarr).mean() + assert result == expected tdarr[0] = pd.NaT assert obj.mean(skipna=False) is pd.NaT From 011021077121bae61a2d93eafbc70fb95aea8992 Mon Sep 17 00:00:00 2001 From: Brock Date: Thu, 9 Dec 2021 13:11:11 -0800 Subject: [PATCH 4/7] update exception messages --- pandas/tests/arithmetic/test_timedelta64.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pandas/tests/arithmetic/test_timedelta64.py b/pandas/tests/arithmetic/test_timedelta64.py index 840426931b152..fbb9ed41bf203 100644 --- a/pandas/tests/arithmetic/test_timedelta64.py +++ b/pandas/tests/arithmetic/test_timedelta64.py @@ -1984,7 +1984,16 @@ def test_td64arr_div_numeric_scalar(self, box_with_array, two): result = tdser / two tm.assert_equal(result, expected) - with pytest.raises(TypeError, match="Cannot divide"): + msg = "|".join( + [ + "Cannot divide", + # 2021-12-09 npdev started giving a new message; not sure if it + # will be changed back + "ufunc 'divide' cannot use operands with types " + r"dtype\('float64'\) and dtype\(' Date: Thu, 9 Dec 2021 15:12:19 -0800 Subject: [PATCH 5/7] update exc messages for npdev --- pandas/tests/arithmetic/test_numeric.py | 18 ++++++++++++++++-- pandas/tests/arithmetic/test_timedelta64.py | 4 ++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/pandas/tests/arithmetic/test_numeric.py b/pandas/tests/arithmetic/test_numeric.py index 4935151ec986e..1e8cfe144ab1f 100644 --- a/pandas/tests/arithmetic/test_numeric.py +++ b/pandas/tests/arithmetic/test_numeric.py @@ -169,7 +169,14 @@ def test_div_td64arr(self, left, box_cls): result = right // left tm.assert_equal(result, expected) - msg = "Cannot divide" + msg = "|".join( + [ + "Cannot divide", + # 2021-12-09 new message in npdev + "ufunc 'divide' cannot use operands with types " + r"dtype\('.*'\) and dtype\(' Date: Fri, 10 Dec 2021 09:40:27 -0800 Subject: [PATCH 6/7] fix array_ufunc bug --- pandas/_libs/ops_dispatch.pyx | 2 +- pandas/tests/arithmetic/test_numeric.py | 18 ++--------------- pandas/tests/arithmetic/test_timedelta64.py | 22 ++------------------- 3 files changed, 5 insertions(+), 37 deletions(-) diff --git a/pandas/_libs/ops_dispatch.pyx b/pandas/_libs/ops_dispatch.pyx index c34504732ac32..2b2a411e6635f 100644 --- a/pandas/_libs/ops_dispatch.pyx +++ b/pandas/_libs/ops_dispatch.pyx @@ -34,7 +34,7 @@ UFUNC_ALIASES = { "true_divide": "truediv", "power": "pow", "remainder": "mod", - "divide": "div", + "divide": "truediv", "equal": "eq", "not_equal": "ne", "less": "lt", diff --git a/pandas/tests/arithmetic/test_numeric.py b/pandas/tests/arithmetic/test_numeric.py index 1e8cfe144ab1f..4935151ec986e 100644 --- a/pandas/tests/arithmetic/test_numeric.py +++ b/pandas/tests/arithmetic/test_numeric.py @@ -169,14 +169,7 @@ def test_div_td64arr(self, left, box_cls): result = right // left tm.assert_equal(result, expected) - msg = "|".join( - [ - "Cannot divide", - # 2021-12-09 new message in npdev - "ufunc 'divide' cannot use operands with types " - r"dtype\('.*'\) and dtype\(' Date: Fri, 10 Dec 2021 12:01:31 -0800 Subject: [PATCH 7/7] revert numpy pin --- .github/workflows/python-dev.yml | 3 +-- ci/deps/actions-39-numpydev.yaml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-dev.yml b/.github/workflows/python-dev.yml index 41e1a7c86d392..2639aa26b6eed 100644 --- a/.github/workflows/python-dev.yml +++ b/.github/workflows/python-dev.yml @@ -49,8 +49,7 @@ jobs: shell: bash run: | python -m pip install --upgrade pip setuptools wheel - # TODO: unpin - pip install -i https://pypi.anaconda.org/scipy-wheels-nightly/simple "numpy==1.23.0.dev0+101.ga81535a36" + pip install -i https://pypi.anaconda.org/scipy-wheels-nightly/simple numpy pip install git+https://github.com/nedbat/coveragepy.git pip install cython python-dateutil pytz hypothesis pytest>=6.2.5 pytest-xdist pytest-cov pytest-timeout pip list diff --git a/ci/deps/actions-39-numpydev.yaml b/ci/deps/actions-39-numpydev.yaml index 48c03399d5fa8..4b8c74d635323 100644 --- a/ci/deps/actions-39-numpydev.yaml +++ b/ci/deps/actions-39-numpydev.yaml @@ -19,6 +19,5 @@ dependencies: - cython==0.29.24 # GH#34014 - "--extra-index-url https://pypi.anaconda.org/scipy-wheels-nightly/simple" - "--pre" - # TODO: Unpin - - "numpy==1.23.0.dev0+101.ga81535a36" + - "numpy" - "scipy"