Skip to content

display.precision not honored for float values in an object index #25919

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

Open
simonjayhawkins opened this issue Mar 29, 2019 · 1 comment
Open
Labels
Bug Output-Formatting __repr__ of pandas objects, to_string

Comments

@simonjayhawkins
Copy link
Member

see also #17280, #25917

Code Sample, a copy-pastable example if possible

import pandas as pd
float_val = 0.55555555
df = pd.DataFrame([float_val, 'foo'], index=[float_val, 'foo'])
pd.set_option('display.precision', 3)
df
0
0.55555555 0.556
foo foo

Problem description

the float valued index values are not displayed with a precision of 3. The expected behavior is observed with a Float64Index when all index values are floats.

Expected Output

0
0.556 0.556
foo foo

Output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.7.2.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None

pandas: 0.25.0.dev0+332.g96a128eaa
pytest: 4.3.0
pip: 19.0.3
setuptools: 40.6.3
Cython: 0.29.5
numpy: 1.16.2
scipy: 1.2.1
pyarrow: 0.11.1
xarray: 0.11.3
IPython: 7.3.0
sphinx: 1.8.4
patsy: 0.5.1
dateutil: 2.8.0
pytz: 2018.9
blosc: None
bottleneck: 1.2.1
tables: 3.4.4
numexpr: 2.6.9
feather: None
matplotlib: 3.0.2
openpyxl: 2.6.0
xlrd: 1.2.0
xlwt: 1.3.0
xlsxwriter: 1.1.5
lxml.etree: 4.3.1
bs4: 4.7.1
html5lib: 1.0.1
sqlalchemy: 1.2.18
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: 0.2.0
fastparquet: 0.2.1
pandas_gbq: None
pandas_datareader: None
gcsfs: None

@simonjayhawkins
Copy link
Member Author

see also #13021

@jschendel jschendel added the Output-Formatting __repr__ of pandas objects, to_string label Apr 3, 2019
@mroeschke mroeschke added the Bug label May 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Output-Formatting __repr__ of pandas objects, to_string
Projects
None yet
Development

No branches or pull requests

3 participants