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

display.precision not honored for column headers #17280

Closed
pblelloch opened this issue Aug 18, 2017 · 3 comments · Fixed by #25914
Closed

display.precision not honored for column headers #17280

pblelloch opened this issue Aug 18, 2017 · 3 comments · Fixed by #25914
Labels
Bug Output-Formatting __repr__ of pandas objects, to_string
Milestone

Comments

@pblelloch
Copy link

Code Sample, a copy-pastable example if possible

import pandas as pd
import numpy as np
pd.options.display.precision = 3
labels = np.random.rand(10)
p = pd.DataFrame(np.random.randn(10,10),index=labels,columns=labels)
p

Problem description

The above code works just fine in a standard console, but in a jupyter notebook the float valued column headers are not displayed with a precision of 3. This appears to be due to the notebook_repr_html option, since setting that to False again honors the precision. Note that the same applies to other formatting options, and if I switch to a MultiIndex it looks fine. I posted this as a question on the pydata discussion site and Joris Van den Bossche confirmed that it was an issue and suggested that I report it here.

Expected Output

Output of pd.show_versions()

[paste the output of pd.show_versions() here below this line]

@pblelloch pblelloch changed the title display.precision no honored for clum display.precision not honored for column headers Aug 18, 2017
@jorisvandenbossche jorisvandenbossche added Bug Output-Formatting __repr__ of pandas objects, to_string labels Aug 18, 2017
@jorisvandenbossche
Copy link
Member

Thanks for reporting!

Note that the same applies to other formatting options

What do you mean exactly with this? That also other formatting options don't work with the notebook repr?

@pblelloch
Copy link
Author

pblelloch commented Aug 18, 2017 via email

@jorisvandenbossche jorisvandenbossche added this to the Next Major Release milestone Aug 18, 2017
@matanox
Copy link

matanox commented Sep 13, 2018

I believe this is not fixed in pandas 0.23.0 at least. Unless it should be seen as a Jupyter notebook issue after all. If we print(p) rather than simply p, the issue does not manifest (but in that case the display is more primitive than without the print).

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

Successfully merging a pull request may close this issue.

4 participants