Skip to content

Commit 7ceefb3

Browse files
authored
DOC: mention that float_format can be a function, not just a string (#27156)
1 parent b115a6b commit 7ceefb3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pandas/core/generic.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -2796,8 +2796,10 @@ def to_latex(self, buf=None, columns=None, col_space=None, header=True,
27962796
Formatter functions to apply to columns' elements by position or
27972797
name. The result of each function must be a unicode string.
27982798
List must be of length equal to the number of columns.
2799-
float_format : str, optional
2800-
Format string for floating point numbers.
2799+
float_format : one-parameter function or str, optional, default None
2800+
Formatter for floating point numbers. For example
2801+
``float_format="%%.2f"`` and ``float_format="{:0.2f}".format`` will
2802+
both result in 0.1234 being formatted as 0.12.
28012803
sparsify : bool, optional
28022804
Set to False for a DataFrame with a hierarchical index to print
28032805
every multiindex key at each row. By default, the value will be

0 commit comments

Comments
 (0)