display.precision not honored for column headers · Issue #17280 · pandas-dev/pandas (original) (raw)

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]