BUG: DataFrame.eval
fails with TypeError with multiline expr but works when eval
line by line
#59062
Open
3 tasks done
Labels
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
DataFrame.eval
fails withTypeError: "value" parameter must be a scalar, dict or Series, but you passed a "ndarray"
with multiline expr but works wheneval
line by line.The culprit seems to be that
pandas/pandas/core/computation/align.py
Line 140 in a60ad39
Scope.resolvers
.Expected Behavior
df.eval(expr)
also works fineInstalled Versions
INSTALLED VERSIONS
commit : d9cdd2e
python : 3.10.12.final.0
python-bits : 64
OS : Linux
OS-release : 6.5.0-1020-aws
Version : #20~22.04.1-Ubuntu SMP Wed May 1 16:10:50 UTC 2024
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8
pandas : 2.2.2
numpy : 1.24.4
pytz : 2023.3
dateutil : 2.8.2
setuptools : 68.1.2
pip : 24.0
Cython : None
pytest : 8.1.1
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : 2.9.9
jinja2 : 3.1.2
IPython : 8.14.0
pandas_datareader : None
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : None
bottleneck : 1.3.7
dataframe-api-compat : None
fastparquet : None
fsspec : 2023.6.0
gcsfs : None
matplotlib : 3.7.2
numba : 0.57.1
numexpr : 2.10.1
odfpy : None
openpyxl : 3.1.2
pandas_gbq : None
pyarrow : 16.0.0
pyreadstat : None
python-calamine : None
pyxlsb : None
s3fs : 2023.6.0
scipy : 1.12.0
sqlalchemy : 2.0.20
tables : None
tabulate : 0.9.0
xarray : 2023.8.0
xlrd : 2.0.1
zstandard : 0.22.0
tzdata : 2023.3
qtpy : None
pyqt5 : None
The text was updated successfully, but these errors were encountered: