Pandas version checks

  • [x] I have checked that this issue has not already been reported.

  • [x] 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

import pandas as pd


series1 = pd.Series([1,2,3,4,5])
series2 = pd.Series([2,3,5,1,2])

pd.eval(
    "(a / b).cumsum()",
    local_dict={"a": series1, "b": series2}
)

Issue Description

AttributeError: 'BinOp' object has no attribute 'value'

raised.

Expected Behavior

0    0.500000
1    1.166667
2    1.766667
3    5.766667
4    8.266667
dtype: float64

should yield this result.

Installed Versions

INSTALLED VERSIONS ------------------ commit : c888af6d0bb674932007623c0867e1fbd4bdc2c6 python : 3.11.10 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.19045 machine : AMD64 processor : Intel64 Family 6 Model 183 Stepping 1, GenuineIntel byteorder : little LC_ALL : None LANG : None LOCALE : English_United States.1252 pandas : 2.3.1 numpy : 2.3.1 pytz : 2025.2 dateutil : 2.9.0.post0 pip : 25.1.1 Cython : None sphinx : None IPython : 9.4.0 adbc-driver-postgresql: None adbc-driver-sqlite : None bs4 : None blosc : None bottleneck : None dataframe-api-compat : None fastparquet : None fsspec : None html5lib : None hypothesis : None gcsfs : None jinja2 : None lxml.etree : None matplotlib : None numba : None numexpr : 2.11.0 odfpy : None openpyxl : None pandas_gbq : None psycopg2 : None pymysql : None pyarrow : None pyreadstat : None pytest : None python-calamine : None pyxlsb : None s3fs : None scipy : None sqlalchemy : None tables : None tabulate : None xarray : None xlrd : None xlsxwriter : None zstandard : None tzdata : 2025.2 qtpy : None pyqt5 : None

Comment From: ryantam626

Also an issue for

import pandas as pd


series1 = pd.Series([0,1,0,2,3,4,5],dtype=bool)

pd.eval(
    "(~a).cumsum()",
    local_dict={"a": series1}
)
AttributeError: 'UnaryOp' object has no attribute 'value'

raised

Excepted

0    1
1    1
2    2
3    2
4    2
5    2
6    2
dtype: int32

Comment From: ryantam626

Actually fixed in a82307f15630690fc288afeed27c549a028d94e9 - sorry for the noise.