pandas.io.formats.style.Styler.format
pandas 3.1.1 · Styling · method
Change how cell values are displayed, such as decimal precision or missing-value text.
Call syntax
Styler.format(…) Full signature
Styler.format(
formatter=None,
subset=None,
na_rep=None,
precision=None,
decimal='.',
thousands=None,
escape=None,
hyperlinks=None,
)Run the example
Edit the example and select Run Python to see the result.
Parameters
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
formatter |
Optional Positional or keyword Default None |
str, callable, dict or None Provide the formatting rule applied to the selected values or labels. |
subset |
Optional Positional or keyword Default None |
label, array-like, IndexSlice Restrict the operation to these labels instead of considering the whole object. |
na_rep |
Optional Positional or keyword Default None |
str Choose the text used to display missing values. |
precision |
Optional Positional or keyword Default None |
int Choose the requested number of decimal places or displayed digits. |
decimal |
Optional Positional or keyword Default '.' |
str Identify the character used as the decimal mark. |
thousands |
Optional Positional or keyword Default None |
str Identify the character separating groups of digits. |
escape |
Optional Positional or keyword Default None |
str Control escaping of reserved output characters. |
hyperlinks |
Optional Positional or keyword Default None |
{"html", "latex"} |
Returns
Styler