-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
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
BUG: df.eval
can't concatenate string column and string via +
#47734
Comments
take |
This looks like a
Your example also works verbatim, if numexpr isn't installed. Looks like an issue in |
I have the same problem. The problem appears to be with the obj_dtype_set = frozenset([np.dtype("object")]) To: obj_dtype_set = frozenset([np.dtype("object"), str]) Then the problem appears fixed for me. |
I have the same problem as well. I'd really appreciate it if someone could have a look at this. As @billziss-gh commented, this is easily fixed. |
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
`df.eval('a + "a"')`` error messages
`df.convert_dtypes().eval('a + "a"')` error messages
Issue Description
df.eval
can't concatenate string column and string via+
operator likedf.eval("string_column + 'a string'")
I also tried some other cases, but they also failed.
df.astype(str).eval("a + 'a'")
faildf.eval("a + 'a'", engine="python")
failExpected Behavior
Installed Versions
While run
pd.show_versions()
I noted I don't have 'numexpr'.So after finishing installing 'numexpr', above cases still couldn't work.
INSTALLED VERSIONS
commit : e8093ba
python : 3.9.13.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19044
machine : AMD64
processor : Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : Chinese (Simplified)_China.936
pandas : 1.4.3
numpy : 1.22.4
pytz : 2022.1
dateutil : 2.8.2
setuptools : 62.6.0
pip : 22.1.2
Cython : None
pytest : None
hypothesis : None
sphinx : 5.0.2
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : 7.33.0
pandas_datareader: None
bs4 : 4.11.1
bottleneck : None
brotli :
fastparquet : None
fsspec : None
gcsfs : None
markupsafe : 2.1.1
matplotlib : 3.5.2
numba : None
numexpr : None
odfpy : None
openpyxl : 3.0.9
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.8.1
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : 2022.3.0
xlrd : 1.2.0
xlwt : 1.3.0
zstandard : None
The text was updated successfully, but these errors were encountered: