pandas.io.formats.style.Styler.format_index
pandas 3.1.1 · Styling · method
Set how index labels or column headers are formatted for display.
Call syntax
Styler.format_index(…) Full signature
Styler.format_index(
formatter=None,
axis=0,
level=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. |
axis |
Optional Positional or keyword Default 0 |
{0, "index", 1, "columns"} Choose which axis the operation acts on. The accepted axis labels depend on the receiver. |
level |
Optional Positional or keyword Default None |
int, str, list Choose an index level by name or integer position. |
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