From 3dbb137f5eaba5f31a2c39862a144f31d6a2f4a4 Mon Sep 17 00:00:00 2001 From: euri10 Date: Sun, 9 Dec 2018 19:52:09 +0100 Subject: [PATCH] Added log10 to the list of unary functions df.eval can handle (#24140) --- doc/source/enhancingperf.rst | 2 +- doc/source/whatsnew/v0.24.0.rst | 1 + pandas/core/computation/ops.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/source/enhancingperf.rst b/doc/source/enhancingperf.rst index c0546d653d532..429ff91d88e41 100644 --- a/doc/source/enhancingperf.rst +++ b/doc/source/enhancingperf.rst @@ -469,7 +469,7 @@ These operations are supported by :func:`pandas.eval`: * Simple variable evaluation, e.g., ``pd.eval('df')`` (this is not very useful) * Math functions: `sin`, `cos`, `exp`, `log`, `expm1`, `log1p`, `sqrt`, `sinh`, `cosh`, `tanh`, `arcsin`, `arccos`, `arctan`, `arccosh`, - `arcsinh`, `arctanh`, `abs` and `arctan2`. + `arcsinh`, `arctanh`, `abs`, `arctan2` and `log10`. This Python syntax is **not** allowed: diff --git a/doc/source/whatsnew/v0.24.0.rst b/doc/source/whatsnew/v0.24.0.rst index 4c78fcb76f4c6..cd39618e4850a 100644 --- a/doc/source/whatsnew/v0.24.0.rst +++ b/doc/source/whatsnew/v0.24.0.rst @@ -1355,6 +1355,7 @@ Numeric - :meth:`Series.agg` can now handle numpy NaN-aware methods like :func:`numpy.nansum` (:issue:`19629`) - Bug in :meth:`Series.rank` and :meth:`DataFrame.rank` when ``pct=True`` and more than 2:sup:`24` rows are present resulted in percentages greater than 1.0 (:issue:`18271`) - Calls such as :meth:`DataFrame.round` with a non-unique :meth:`CategoricalIndex` now return expected data. Previously, data would be improperly duplicated (:issue:`21809`). +- Added ``log10`` to the list of supported functions in :meth:`DataFrame.eval` (:issue:`24139`) Strings ^^^^^^^ diff --git a/pandas/core/computation/ops.py b/pandas/core/computation/ops.py index 9e9f124352229..cbdb3525d5e88 100644 --- a/pandas/core/computation/ops.py +++ b/pandas/core/computation/ops.py @@ -23,7 +23,7 @@ _unary_math_ops = ('sin', 'cos', 'exp', 'log', 'expm1', 'log1p', 'sqrt', 'sinh', 'cosh', 'tanh', 'arcsin', 'arccos', - 'arctan', 'arccosh', 'arcsinh', 'arctanh', 'abs') + 'arctan', 'arccosh', 'arcsinh', 'arctanh', 'abs', 'log10') _binary_math_ops = ('arctan2',) _mathops = _unary_math_ops + _binary_math_ops