pandas.io.formats.style.Styler.to_html

pandas 3.1.1 · Input and output · method

Render the receiver as an HTML table. A Styler includes applicable styling rules in its output.

Call syntax

Styler.to_html(…) Full signature
Styler.to_html(
    buf=None,
    *,
    table_uuid=None,
    table_attributes=None,
    sparse_index=None,
    sparse_columns=None,
    bold_headers=False,
    caption=None,
    max_rows=None,
    max_columns=None,
    encoding=None,
    doctype_html=False,
    exclude_styles=False,
    **kwargs,
)

Run the example

Edit the example and select Run Python to see the result.

Parameters

ParameterRequirementAccepted values and behavior
buf Optional
Positional or keyword
Default None
str, path object, file-like object

Supply a destination file-like buffer, or use the default to return or print the output as documented.

table_uuid Optional
Keyword only
Default None
str
table_attributes Optional
Keyword only
Default None
str
sparse_index Optional
Keyword only
Default None
bool
sparse_columns Optional
Keyword only
Default None
bool
bold_headers Optional
Keyword only
Default False
bool
caption Optional
Keyword only
Default None
str

Provide the title or caption used in rendered output.

max_rows Optional
Keyword only
Default None
int
max_columns Optional
Keyword only
Default None
int
encoding Optional
Keyword only
Default None
str

Name a text encoding such as "utf-8".

doctype_html Optional
Keyword only
Default False
bool
exclude_styles Optional
Keyword only
Default False
bool
**kwargs Optional
Additional keyword arguments

Returns

str or None