Skip to content

Add raw_html parameter to Styler.format, enabling richer output #40388

Closed
@jnothman

Description

@jnothman

Styler.format could allow a parameter raw_html (bool, False for current behaviour), enabling richer output

For example, df.style.format(lambda s: f"<a href='https://en.wikipedia.org/wiki/{html.escape(s)}'>{html.escape(s)}</a>", raw_html=True) could be used to turn a column of values into a column of links to English Wikipedia articles, when exported with to_html.

To achieve this, we would need to always pass raw HTML to the jina templates, changing how formatting is currently done in Styler.to_html.

Formats performed with raw_html=True would have no effect on Styler.to_excel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    IO HTMLread_html, to_html, Styler.apply, Styler.applymapStylerconditional formatting using DataFrame.style

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions