|
15 | 15 | import pandas as pd
|
16 | 16 | from pandas.core.base import StringMixin
|
17 | 17 | import pandas.core.common as com
|
18 |
| -from pandas.core.computation.check import _NUMEXPR_INSTALLED, _NUMEXPR_VERSION |
19 | 18 | from pandas.core.computation.common import _ensure_decoded, _result_type_many
|
20 | 19 | from pandas.core.computation.scope import _DEFAULT_GLOBALS
|
21 | 20 |
|
|
25 | 24 |
|
26 | 25 | _unary_math_ops = ('sin', 'cos', 'exp', 'log', 'expm1', 'log1p',
|
27 | 26 | 'sqrt', 'sinh', 'cosh', 'tanh', 'arcsin', 'arccos',
|
28 |
| - 'arctan', 'arccosh', 'arcsinh', 'arctanh', 'abs', 'log10') |
| 27 | + 'arctan', 'arccosh', 'arcsinh', 'arctanh', 'abs', 'log10', |
| 28 | + 'floor', 'ceil' |
| 29 | + ) |
29 | 30 | _binary_math_ops = ('arctan2',)
|
30 |
| -if _NUMEXPR_INSTALLED and _NUMEXPR_VERSION >= LooseVersion('2.6.9'): |
31 |
| - _unary_math_ops += ('floor', 'ceil') |
32 | 31 |
|
33 | 32 | _mathops = _unary_math_ops + _binary_math_ops
|
34 | 33 |
|
@@ -544,9 +543,12 @@ def __unicode__(self):
|
544 | 543 |
|
545 | 544 |
|
546 | 545 | class FuncNode(object):
|
547 |
| - |
548 | 546 | def __init__(self, name):
|
549 |
| - if name not in _mathops: |
| 547 | + from pandas.core.computation.check import _NUMEXPR_INSTALLED, _NUMEXPR_VERSION |
| 548 | + if name not in _mathops or ( |
| 549 | + _NUMEXPR_INSTALLED and _NUMEXPR_VERSION < LooseVersion('2.6.9') and |
| 550 | + name in ('floor', 'ceil') |
| 551 | + ): |
550 | 552 | raise ValueError(
|
551 | 553 | "\"{0}\" is not a supported function".format(name))
|
552 | 554 |
|
|
0 commit comments