Skip to content

API/ENH: Styler template arguments #15649

Closed
@chris-b1

Description

@chris-b1

Usecase - I have a Styler subclass with a new template that I want to pass some arbitrary stuff into - which currently there isn't a great way to do (right now I'm overriding and re-implementing .render()).

Open to suggestions on the api, but I was thinking of adding template_args argument that would be passed to the template.

from pandas.formats.style import Styler
from jinja2 import Template

class MyStyler(Styler):
    template = Template("""
        .... omitted
        {{ my_value_1 }}
        """)

MyStyler(df, template_args={'my_value_1': '...'}).render()

xref #11610 (master tracker)

pandas 0.19.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    IO HTMLread_html, to_html, Styler.apply, Styler.applymap

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions