@@ -97,6 +97,15 @@ def _mpl(func: Callable):
97
97
color = """color : str, default 'yellow'
98
98
Background color to use for highlighting."""
99
99
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
+
100
109
#
101
110
###
102
111
@@ -1053,6 +1062,7 @@ def to_latex(
1053
1062
latex , buf = buf , encoding = None if buf is None else encoding
1054
1063
)
1055
1064
1065
+ @Substitution (buf = buf , encoding = encoding )
1056
1066
def to_html (
1057
1067
self ,
1058
1068
buf : FilePath | WriteBuffer [str ] | None = None ,
@@ -1077,10 +1087,7 @@ def to_html(
1077
1087
1078
1088
Parameters
1079
1089
----------
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
1084
1091
table_uuid : str, optional
1085
1092
Id attribute assigned to the <table> HTML element in the format:
1086
1093
@@ -1127,9 +1134,7 @@ def to_html(
1127
1134
which is 262144 (18 bit browser rendering).
1128
1135
1129
1136
.. 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
1133
1138
doctype_html : bool, default False
1134
1139
Whether to output a fully structured HTML file including all
1135
1140
HTML elements, or just the core ``<style>`` and ``<table>`` elements.
@@ -1189,6 +1194,7 @@ def to_html(
1189
1194
html , buf = buf , encoding = (encoding if buf is not None else None )
1190
1195
)
1191
1196
1197
+ @Substitution (buf = buf , encoding = encoding )
1192
1198
def to_string (
1193
1199
self ,
1194
1200
buf = None ,
@@ -1207,11 +1213,8 @@ def to_string(
1207
1213
1208
1214
Parameters
1209
1215
----------
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
1215
1218
sparse_index : bool, optional
1216
1219
Whether to sparsify the display of a hierarchical index. Setting to False
1217
1220
will display each explicit level element in a hierarchical key for each row.
0 commit comments