pandas.errors.NumExprClobberingError#

exception pandas.errors.NumExprClobberingError[source]#

Exception raised when trying to use a built-in numexpr name as a variable name.

eval or query will throw the error if the engine is set to ‘numexpr’. ‘numexpr’ is the default engine value for these methods if the numexpr package is installed.

See also

eval

Evaluate a Python expression as a string using various backends.

DataFrame.query

Query the columns of a DataFrame with a boolean expression.

Examples

>>> df = pd.DataFrame({"abs": [1, 1, 1]})
>>> df.query("abs > 2")  
... # NumExprClobberingError: Variables in expression "(abs) > (2)" overlap...
>>> sin, a = 1, 2
>>> pd.eval("sin + a", engine="numexpr")  
... # NumExprClobberingError: Variables in expression "(sin) + (a)" overlap...