You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would expect all values to be -0.03 but pandas rounds -0.025 to -0.02. I suspect this is due to bankers rounding, which would be fine, but it also looks like pandas doesn't mimic the native python rounding behaviour, which rounds both to -0.03 - this might trip people up.
Expected Behavior
Round -0.025 to -0.03, or if this explicitly avoided as part of your rounding strategy, at least make your strategy match the python round function.
Installed Versions
INSTALLED VERSIONS
commit : d9cdd2e
python : 3.10.15.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.22631
machine : AMD64
processor : Intel64 Family 6 Model 186 Stepping 3, GenuineIntel
byteorder : little
LC_ALL : None
LANG : en
LOCALE : English_United Kingdom.1252
I would like to take this up as my first PR - @rhshadrach I see the round to even already mentioned though - Can you suggest if there was anything specific you were thinking of ?
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
I would expect all values to be -0.03 but pandas rounds -0.025 to -0.02. I suspect this is due to bankers rounding, which would be fine, but it also looks like pandas doesn't mimic the native python rounding behaviour, which rounds both to -0.03 - this might trip people up.
Expected Behavior
Round -0.025 to -0.03, or if this explicitly avoided as part of your rounding strategy, at least make your strategy match the python round function.
Installed Versions
INSTALLED VERSIONS
commit : d9cdd2e
python : 3.10.15.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.22631
machine : AMD64
processor : Intel64 Family 6 Model 186 Stepping 3, GenuineIntel
byteorder : little
LC_ALL : None
LANG : en
LOCALE : English_United Kingdom.1252
pandas : 2.2.2
numpy : 1.26.4
pytz : 2024.1
dateutil : 2.9.0.post0
setuptools : 75.1.0
pip : 22.3.1
Cython : None
pytest : 8.3.4
hypothesis : None
sphinx : 7.3.7
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.4
IPython : 8.27.0
pandas_datareader : None
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : 4.12.3
bottleneck : 1.3.7
dataframe-api-compat : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.9.2
numba : None
numexpr : 2.10.1
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
python-calamine : None
pyxlsb : None
s3fs : None
scipy : 1.14.1
sqlalchemy : None
tables : None
tabulate : 0.9.0
xarray : None
xlrd : None
zstandard : None
tzdata : 2023.3
qtpy : 2.4.1
pyqt5 : None
The text was updated successfully, but these errors were encountered: