@@ -188,15 +188,6 @@ def eval(
188
188
"""
189
189
Evaluate a Python expression as a string using various backends.
190
190
191
- The following arithmetic operations are supported: ``+``, ``-``, ``*``,
192
- ``/``, ``**``, ``%``, ``//`` (python engine only) along with the following
193
- boolean operations: ``|`` (or), ``&`` (and), and ``~`` (not).
194
- Additionally, the ``'pandas'`` parser allows the use of :keyword:`and`,
195
- :keyword:`or`, and :keyword:`not` with the same semantics as the
196
- corresponding bitwise operators. :class:`~pandas.Series` and
197
- :class:`~pandas.DataFrame` objects are supported and behave as they would
198
- with plain ol' Python evaluation.
199
-
200
191
.. warning::
201
192
202
193
``eval`` can run arbitrary code which can make you vulnerable to code
@@ -210,6 +201,34 @@ def eval(
210
201
<https://docs.python.org/3/reference/simple_stmts.html#simple-statements>`__,
211
202
only Python `expressions
212
203
<https://docs.python.org/3/reference/simple_stmts.html#expression-statements>`__.
204
+
205
+ By default, with the numexpr engine, the following operations are supported:
206
+
207
+ - Arthimetic operations: ``+``, ``-``, ``*``, ``/``, ``**``, ``%``
208
+ - Boolean operations: ``|`` (or), ``&`` (and), and ``~`` (not)
209
+ - Comparison operators: ``<``, ``<=``, ``==``, ``!=``, ``>=``, ``>``
210
+
211
+ Furthermore, the following mathematical functions are supported:
212
+
213
+ - Trigonometric: ``sin``, ``cos``, ``tan``, ``arcsin``, ``arccos``, \
214
+ ``arctan``, ``arctan2``, ``sinh``, ``cosh``, ``tanh``, ``arcsinh``, \
215
+ ``arccosh`` and ``arctanh``
216
+ - Logarithms: ``log`` natural, ``log10`` base 10, ``log1p`` log(1+x)
217
+ - Absolute Value ``abs``
218
+ - Square root ``sqrt``
219
+ - Exponential ``exp`` and Exponential minus one ``expm1``
220
+
221
+ See the numexpr engine `documentation
222
+ <https://numexpr.readthedocs.io/en/latest/user_guide.html#supported-functions>`__
223
+ for further function support details.
224
+
225
+ Using the ``'python'`` engine allows the use of native Python operators
226
+ such as floor division ``//``, in addition to built-in and user-defined
227
+ Python functions.
228
+
229
+ Additionally, the ``'pandas'`` parser allows the use of :keyword:`and`,
230
+ :keyword:`or`, and :keyword:`not` with the same semantics as the
231
+ corresponding bitwise operators.
213
232
parser : {'pandas', 'python'}, default 'pandas'
214
233
The parser to use to construct the syntax tree from the expression. The
215
234
default of ``'pandas'`` parses code slightly different than standard
0 commit comments