Skip to content

Commit

Permalink
DEPS: bump min numexpr version to 2.7.0 (pandas-dev#41558)
Browse files Browse the repository at this point in the history
  • Loading branch information
fangchenli authored May 21, 2021
1 parent b04dad7 commit 3fec908
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 40 deletions.
2 changes: 1 addition & 1 deletion ci/deps/actions-37-minimum_versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion doc/source/getting_started/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ Recommended dependencies

* `numexpr <https://github.com/pydata/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 <https://github.com/pydata/bottleneck>`__: for accelerating certain types of ``nan``
evaluations. ``bottleneck`` uses specialized cython routines to achieve large speedups. If installed,
Expand Down
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v1.3.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
+-----------------+-----------------+----------+---------+
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pandas/compat/_optional.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
13 changes: 1 addition & 12 deletions pandas/core/computation/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)

Expand Down
23 changes: 1 addition & 22 deletions pandas/tests/computation/test_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -51,7 +50,6 @@
_binary_ops_dict,
_unary_math_ops,
)
from pandas.util.version import Version


@pytest.fixture(
Expand All @@ -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())
Expand Down Expand Up @@ -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)})
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3fec908

Please sign in to comment.