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

BUG: pandas.cut doesnt respect to precision=3 when include_lowest=True #46797

Closed
2 of 3 tasks
eromoe opened this issue Apr 18, 2022 · 2 comments
Closed
2 of 3 tasks

BUG: pandas.cut doesnt respect to precision=3 when include_lowest=True #46797

eromoe opened this issue Apr 18, 2022 · 2 comments
Labels
Bug cut cut, qcut Duplicate Report Duplicate issue or pull request Interval Interval data type

Comments

@eromoe
Copy link

eromoe commented Apr 18, 2022

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

a  = pd.Series(np.linspace(-0.9999999, 10, 200))
pd.cut(a, 10, retbins=True, include_lowest=True, precision=3)

Issue Description

image

Expected Behavior

lowest value should be precision=3

Installed Versions

INSTALLED VERSIONS

commit : 4bfe3d0
python : 3.8.8.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19041
machine : AMD64
processor : AMD64 Family 25 Model 33 Stepping 0, AuthenticAMD
byteorder : little
LC_ALL : None
LANG : None
LOCALE : Chinese (Simplified)_China.936

pandas : 1.4.2
numpy : 1.19.5
pytz : 2021.1
dateutil : 2.8.1
pip : 22.0.4
setuptools : 44.0.0
Cython : 0.29.23
pytest : 6.2.3
hypothesis : None
sphinx : 4.0.1
blosc : None
feather : 0.4.1
xlsxwriter : 1.3.8
lxml.etree : 4.6.3
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : 3.1.1
IPython : 7.22.0
pandas_datareader: None
bs4 : 4.9.3
bottleneck : 1.3.2
brotli :
fastparquet : None
fsspec : 2021.07.0
gcsfs : None
markupsafe : 2.1.1
matplotlib : 3.3.4
numba : 0.53.1
numexpr : 2.7.3
odfpy : None
openpyxl : 3.0.7
pandas_gbq : None
pyarrow : 7.0.0
pyreadstat : None
pyxlsb : None
s3fs : 2021.07.0
scipy : 1.6.2
snappy : None
sqlalchemy : 1.4.7
tables : 3.6.1
tabulate : 0.8.9
xarray : None
xlrd : 2.0.1
xlwt : 1.3.0
zstandard : None

@eromoe eromoe added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Apr 18, 2022
@simonjayhawkins
Copy link
Member

Thanks @eromoe for the report.

The bug appears to be in the rounding and adjust logic in _format_labels in pandas/core/reshape/tile.py

further investigations and PRs welcome.

@simonjayhawkins simonjayhawkins added cut cut, qcut and removed Needs Triage Issue that has not been reviewed by a pandas team member labels May 29, 2022
@simonjayhawkins simonjayhawkins added this to the Contributions Welcome milestone May 29, 2022
@simonjayhawkins simonjayhawkins added the Interval Interval data type label May 29, 2022
@simonjayhawkins
Copy link
Member

closing as duplicate of #33912

@simonjayhawkins simonjayhawkins added the Duplicate Report Duplicate issue or pull request label May 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug cut cut, qcut Duplicate Report Duplicate issue or pull request Interval Interval data type
Projects
None yet
Development

No branches or pull requests

2 participants