Skip to content

display.precision not honored for column headers #17280

Closed
@pblelloch

Description

@pblelloch

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions