pandas.io.formats.style.Styler.from_custom_template#
- classmethod Styler.from_custom_template(searchpath, html_table=None, html_style=None)[源代码]#
用于创建
Styler子类的工厂函数。使用自定义模板和 Jinja 环境。
在 1.3.0 版本发生变更.
- Parameters:
- searchpathstr 或 list
包含模板的目录的路径或路径列表。
- html_tablestr
用于替换 html_table 模板的自定义模板名称。
在 1.3.0 版本加入.
- html_stylestr
用于替换 html_style 模板的自定义模板名称。
在 1.3.0 版本加入.
- Returns:
- MyStylerStyler 的子类
设置了正确的
env、template_html、template_html_table和template_html_style类属性。
Examples
>>> from pandas.io.formats.style import Styler >>> EasyStyler = Styler.from_custom_template("path/to/template", ... "template.tpl", ... ) >>> df = pd.DataFrame({"A": [1, 2]}) >>> EasyStyler(df)
有关更多示例,请参阅:Table Visualization 。