From 3fec908b126e922d9bf2b2470a7cb8aa15a740ab Mon Sep 17 00:00:00 2001 From: Fangchen Li Date: Fri, 21 May 2021 10:57:51 -0500 Subject: [PATCH] DEPS: bump min numexpr version to 2.7.0 (#41558) --- ci/deps/actions-37-minimum_versions.yaml | 2 +- doc/source/getting_started/install.rst | 2 +- doc/source/whatsnew/v1.3.0.rst | 2 +- environment.yml | 2 +- pandas/compat/_optional.py | 2 +- pandas/core/computation/ops.py | 13 +------------ pandas/tests/computation/test_eval.py | 23 +---------------------- requirements-dev.txt | 2 +- 8 files changed, 8 insertions(+), 40 deletions(-) diff --git a/ci/deps/actions-37-minimum_versions.yaml b/ci/deps/actions-37-minimum_versions.yaml index aa5284e4f35d1..b97601d18917c 100644 --- a/ci/deps/actions-37-minimum_versions.yaml +++ b/ci/deps/actions-37-minimum_versions.yaml @@ -17,7 +17,7 @@ dependencies: - bottleneck=1.2.1 - jinja2=2.10 - numba=0.46.0 - - numexpr=2.6.8 + - numexpr=2.7.0 - numpy=1.17.3 - openpyxl=3.0.0 - pytables=3.5.1 diff --git a/doc/source/getting_started/install.rst b/doc/source/getting_started/install.rst index ce35e9e15976f..be9c0da34f8a9 100644 --- a/doc/source/getting_started/install.rst +++ b/doc/source/getting_started/install.rst @@ -234,7 +234,7 @@ Recommended dependencies * `numexpr `__: for accelerating certain numerical operations. ``numexpr`` uses multiple cores as well as smart chunking and caching to achieve large speedups. - If installed, must be Version 2.6.8 or higher. + If installed, must be Version 2.7.0 or higher. * `bottleneck `__: for accelerating certain types of ``nan`` evaluations. ``bottleneck`` uses specialized cython routines to achieve large speedups. If installed, diff --git a/doc/source/whatsnew/v1.3.0.rst b/doc/source/whatsnew/v1.3.0.rst index 27f18d6b7f33a..79180b45bcf31 100644 --- a/doc/source/whatsnew/v1.3.0.rst +++ b/doc/source/whatsnew/v1.3.0.rst @@ -572,7 +572,7 @@ If installed, we now require: +-----------------+-----------------+----------+---------+ | bottleneck | 1.2.1 | | | +-----------------+-----------------+----------+---------+ -| numexpr | 2.6.8 | | | +| numexpr | 2.7.0 | | X | +-----------------+-----------------+----------+---------+ | pytest (dev) | 6.0 | | X | +-----------------+-----------------+----------+---------+ diff --git a/environment.yml b/environment.yml index 56a36c593a458..bb96235123af3 100644 --- a/environment.yml +++ b/environment.yml @@ -81,7 +81,7 @@ dependencies: - ipython>=7.11.1 - jinja2<3.0.0 # pandas.Styler - matplotlib>=2.2.2 # pandas.plotting, Series.plot, DataFrame.plot - - numexpr>=2.6.8 + - numexpr>=2.7.0 - scipy>=1.2 - numba>=0.46.0 diff --git a/pandas/compat/_optional.py b/pandas/compat/_optional.py index f8eccfeb2c60a..2c184c38e6b1a 100644 --- a/pandas/compat/_optional.py +++ b/pandas/compat/_optional.py @@ -17,7 +17,7 @@ "gcsfs": "0.6.0", "lxml.etree": "4.3.0", "matplotlib": "2.2.3", - "numexpr": "2.6.8", + "numexpr": "2.7.0", "odfpy": "1.3.0", "openpyxl": "3.0.0", "pandas_gbq": "0.12.0", diff --git a/pandas/core/computation/ops.py b/pandas/core/computation/ops.py index 231beb40e9630..8758565cf9f2a 100644 --- a/pandas/core/computation/ops.py +++ b/pandas/core/computation/ops.py @@ -27,7 +27,6 @@ result_type_many, ) from pandas.core.computation.scope import DEFAULT_GLOBALS -from pandas.util.version import Version from pandas.io.formats.printing import ( pprint_thing, @@ -616,18 +615,8 @@ def __repr__(self) -> str: class FuncNode: def __init__(self, name: str): - from pandas.core.computation.check import ( - NUMEXPR_INSTALLED, - NUMEXPR_VERSION, - ) - - if name not in MATHOPS or ( - NUMEXPR_INSTALLED - and Version(NUMEXPR_VERSION) < Version("2.6.9") - and name in ("floor", "ceil") - ): + if name not in MATHOPS: raise ValueError(f'"{name}" is not a supported function') - self.name = name self.func = getattr(np, name) diff --git a/pandas/tests/computation/test_eval.py b/pandas/tests/computation/test_eval.py index 9ee53a9d7c54d..0467bb1dad676 100644 --- a/pandas/tests/computation/test_eval.py +++ b/pandas/tests/computation/test_eval.py @@ -29,7 +29,6 @@ ) import pandas._testing as tm from pandas.core.computation import pytables -from pandas.core.computation.check import NUMEXPR_VERSION from pandas.core.computation.engines import ( ENGINES, NumExprClobberingError, @@ -51,7 +50,6 @@ _binary_ops_dict, _unary_math_ops, ) -from pandas.util.version import Version @pytest.fixture( @@ -76,20 +74,8 @@ def parser(request): return request.param -@pytest.fixture -def ne_lt_2_6_9(): - if NUMEXPR_INSTALLED and Version(NUMEXPR_VERSION) >= Version("2.6.9"): - pytest.skip("numexpr is >= 2.6.9") - return "numexpr" - - def _get_unary_fns_for_ne(): - if NUMEXPR_INSTALLED: - if Version(NUMEXPR_VERSION) >= Version("2.6.9"): - return list(_unary_math_ops) - else: - return [x for x in _unary_math_ops if x not in ["floor", "ceil"]] - return [] + return list(_unary_math_ops) if NUMEXPR_INSTALLED else [] @pytest.fixture(params=_get_unary_fns_for_ne()) @@ -1766,13 +1752,6 @@ def test_unary_functions(self, unary_fns_for_ne): expect = getattr(np, fn)(a) tm.assert_series_equal(got, expect, check_names=False) - @pytest.mark.parametrize("fn", ["floor", "ceil"]) - def test_floor_and_ceil_functions_raise_error(self, ne_lt_2_6_9, fn): - msg = f'"{fn}" is not a supported function' - with pytest.raises(ValueError, match=msg): - expr = f"{fn}(100)" - self.eval(expr) - @pytest.mark.parametrize("fn", _binary_math_ops) def test_binary_functions(self, fn): df = DataFrame({"a": np.random.randn(10), "b": np.random.randn(10)}) diff --git a/requirements-dev.txt b/requirements-dev.txt index d1fafbbf9101d..f454bfd15236c 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -53,7 +53,7 @@ ipykernel ipython>=7.11.1 jinja2<3.0.0 matplotlib>=2.2.2 -numexpr>=2.6.8 +numexpr>=2.7.0 scipy>=1.2 numba>=0.46.0 beautifulsoup4>=4.6.0