Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RecursionError when using pd.eval with numexpr on all None object series #21088

Open
tandreas opened this issue May 16, 2018 · 1 comment
Open
Labels
Bug expressions pd.eval, query

Comments

@tandreas
Copy link

Code Sample, a copy-pastable example if possible

import pandas as pd

df = pd.DataFrame({'a': [None, None]})

df.eval('a + a', engine='python')
"""
>>> df.eval('a + a', engine='python')
0    NaN
1    NaN
Name: a, dtype: object
"""

# Results in RecursionError
df.eval('a + a', engine='numexpr')

Problem description

Evaluation of the expression should be consistent between python engine and numexpr engine. I assume the python engine behavior would be the preferred behavior.

Expected Output

df.eval('a + a', engine='numexpr')
0 NaN
1 NaN
Name: a, dtype: object

Output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.6.2.final.0
python-bits: 64
OS: Linux
OS-release: 3.13.0-143-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8

pandas: 0.23.0
pytest: None
pip: 9.0.1
setuptools: 36.4.0
Cython: None
numpy: 1.13.1
scipy: None
pyarrow: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.6.1
pytz: 2017.2
blosc: None
bottleneck: None
tables: None
numexpr: 2.6.5
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None

@jreback
Copy link
Contributor

jreback commented May 16, 2018

I assume the python engine behavior would be the preferred behavior.

this function is designed around speeding up large operations, not providing full compatibility for numexpr, thus arbitrary operations are just not supported.

if you want to provide support for additional things great.

@mroeschke mroeschke added Bug Numeric Operations Arithmetic, Comparison, and Logical operations labels Jan 13, 2019
@jbrockmendel jbrockmendel added the expressions pd.eval, query label Oct 22, 2019
@mroeschke mroeschke removed the Numeric Operations Arithmetic, Comparison, and Logical operations label Jun 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug expressions pd.eval, query
Projects
None yet
Development

No branches or pull requests

4 participants