Skip to content

ENH: DataFrame.style option for hiding the index #14194

Closed
@TomAugspurger

Description

@TomAugspurger

Code Sample, a copy-pastable example if possible

df = pd.DataFrame(np.random.randn(10, 2))
df.style.set_include_index(False)  # name TBD

Expected Output

Same output, but without the index

Would maybe want a way to hide the columns too.


Current workaround

df = pd.DataFrame(np.random.randn(10, 2))
df.style.set_table_styles([
    {'selector': '.row_heading, .blank', 'props': [('display', 'none;')]}
])

This doesn't work if there's a df.index.name and almost surely doesn't work with MultiIndexes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Code StyleCode style, linting, code_checks

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions