@@ -97,6 +97,15 @@ def _mpl(func: Callable):
9797color = """color : str, default 'yellow'
9898 Background color to use for highlighting."""
9999
100+ buf = """buf : str, path object, file-like object, optional
101+ String, path object (implementing ``os.PathLike[str]``), or file-like
102+ object implementing a string ``write()`` function. If ``None``, the result is
103+ returned as a string."""
104+
105+ encoding = """encoding : str, optional
106+ Character encoding setting for file output (and meta tags if available).
107+ Defaults to ``pandas.options.styler.render.encoding`` value of "utf-8"."""
108+
100109#
101110###
102111
@@ -1053,6 +1062,7 @@ def to_latex(
10531062 latex , buf = buf , encoding = None if buf is None else encoding
10541063 )
10551064
1065+ @Substitution (buf = buf , encoding = encoding )
10561066 def to_html (
10571067 self ,
10581068 buf : FilePath | WriteBuffer [str ] | None = None ,
@@ -1077,10 +1087,7 @@ def to_html(
10771087
10781088 Parameters
10791089 ----------
1080- buf : str, path object, file-like object, or None, default None
1081- String, path object (implementing ``os.PathLike[str]``), or file-like
1082- object implementing a string ``write()`` function. If None, the result is
1083- returned as a string.
1090+ %(buf)s
10841091 table_uuid : str, optional
10851092 Id attribute assigned to the <table> HTML element in the format:
10861093
@@ -1127,9 +1134,7 @@ def to_html(
11271134 which is 262144 (18 bit browser rendering).
11281135
11291136 .. versionadded:: 1.4.0
1130- encoding : str, optional
1131- Character encoding setting for file output, and HTML meta tags.
1132- Defaults to ``pandas.options.styler.render.encoding`` value of "utf-8".
1137+ %(encoding)s
11331138 doctype_html : bool, default False
11341139 Whether to output a fully structured HTML file including all
11351140 HTML elements, or just the core ``<style>`` and ``<table>`` elements.
@@ -1189,6 +1194,7 @@ def to_html(
11891194 html , buf = buf , encoding = (encoding if buf is not None else None )
11901195 )
11911196
1197+ @Substitution (buf = buf , encoding = encoding )
11921198 def to_string (
11931199 self ,
11941200 buf = None ,
@@ -1207,11 +1213,8 @@ def to_string(
12071213
12081214 Parameters
12091215 ----------
1210- buf : str, Path, or StringIO-like, optional, default None
1211- Buffer to write to. If ``None``, the output is returned as a string.
1212- encoding : str, optional
1213- Character encoding setting for file output.
1214- Defaults to ``pandas.options.styler.render.encoding`` value of "utf-8".
1216+ %(buf)s
1217+ %(encoding)s
12151218 sparse_index : bool, optional
12161219 Whether to sparsify the display of a hierarchical index. Setting to False
12171220 will display each explicit level element in a hierarchical key for each row.
0 commit comments