MCPcopy
hub / github.com/pandas-dev/pandas / format_index_names

Method format_index_names

pandas/io/formats/style_render.py:1582–1714  ·  view source on GitHub ↗

r""" Format the text display value of index names or column names. .. versionadded:: 3.0 Parameters ---------- formatter : str, callable, dict or None Object to define how values are displayed. See notes. axis : {0, "index", 1, "columns"}

(
        self,
        formatter: ExtFormatter | None = None,
        axis: Axis = 0,
        level: Level | list[Level] | None = None,
        na_rep: str | None = None,
        precision: int | None = None,
        decimal: str = ".",
        thousands: str | None = None,
        escape: str | None = None,
        hyperlinks: str | None = None,
    )

Source from the content-addressed store, hash-verified

1580 return self
1581
1582 def format_index_names(
1583 self,
1584 formatter: ExtFormatter | None = None,
1585 axis: Axis = 0,
1586 level: Level | list[Level] | None = None,
1587 na_rep: str | None = None,
1588 precision: int | None = None,
1589 decimal: str = ".",
1590 thousands: str | None = None,
1591 escape: str | None = None,
1592 hyperlinks: str | None = None,
1593 ) -> StylerRenderer:
1594 r"""
1595 Format the text display value of index names or column names.
1596
1597 .. versionadded:: 3.0
1598
1599 Parameters
1600 ----------
1601 formatter : str, callable, dict or None
1602 Object to define how values are displayed. See notes.
1603 axis : {0, "index", 1, "columns"}
1604 Whether to apply the formatter to the index or column headers.
1605 level : int, str, list
1606 The level(s) over which to apply the generic formatter.
1607 na_rep : str, optional
1608 Representation for missing values.
1609 If ``na_rep`` is None, no special formatting is applied.
1610 precision : int, optional
1611 Floating point precision to use for display purposes, if not determined by
1612 the specified ``formatter``.
1613 decimal : str, default "."
1614 Character used as decimal separator for floats, complex and integers.
1615 thousands : str, optional, default None
1616 Character used as thousands separator for floats, complex and integers.
1617 escape : str, optional
1618 Use 'html' to replace the characters ``&``, ``<``, ``>``, ``&#x27;``, and ``"``
1619 in cell display string with HTML-safe sequences.
1620 Use 'latex' to replace the characters ``&``, ``%``, ``$``, ``#``, ``_``,
1621 ``{``, ``}``, ``~``, ``^``, and ``\`` in the cell display string with
1622 LaTeX-safe sequences.
1623 Escaping is done before ``formatter``.
1624 hyperlinks : {"html", "latex"}, optional
1625 Convert string patterns containing https://, http://, ftp:// or www. to
1626 HTML <a> tags as clickable URL hyperlinks if "html", or LaTeX \href
1627 commands if "latex".
1628
1629 Returns
1630 -------
1631 Styler
1632 Returns itself for chaining.
1633
1634 Raises
1635 ------
1636 ValueError
1637 If the `formatter` is a string and the dtypes are incompatible.
1638
1639 See Also

Calls 7

refactor_levelsFunction · 0.85
_maybe_wrap_formatterFunction · 0.85
_get_axis_numberMethod · 0.80
clearMethod · 0.80
_get_level_numberMethod · 0.45
itemsMethod · 0.45
getMethod · 0.45