Skip to content

Columns Index Name with to_html(index_names=False) is displayed. #22747

@simonjayhawkins

Description

@simonjayhawkins
Member

Code Sample

df = pd.DataFrame(np.zeros((2, 2), dtype=int))
df.columns.name = 'columns.name'
df.to_html(index_names=False)

Output

columns.name 0 1
0 0 0
1 0 0

Problem description

from the docs:

index_names : bool, optional
Prints the names of the indexes, default True

The problem occurs with both standard and MultiIndex columns index. The expected behavior is observed on the (row) Index, if it has names they are not displayed.

Expected Output

0 1
0 0 0
1 0 0

Output of pd.show_versions()

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIO HTMLread_html, to_html, Styler.apply, Styler.applymap

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Participants

      @jreback@gfyoung@simonjayhawkins

      Issue actions

        Columns Index Name with to_html(index_names=False) is displayed. · Issue #22747 · pandas-dev/pandas