polars.Config.set_tbl_formatting
-
Set table formatting style.
- Parameters:
-
-
formatstr -
- “ASCII_FULL”: ASCII, with all borders and lines, including row dividers.
- “ASCII_FULL_CONDENSED”: Same as ASCII_FULL, but with dense row spacing.
- “ASCII_NO_BORDERS”: ASCII, no borders.
- “ASCII_BORDERS_ONLY”: ASCII, borders only.
- “ASCII_BORDERS_ONLY_CONDENSED”: ASCII, borders only, dense row spacing.
- “ASCII_HORIZONTAL_ONLY”: ASCII, horizontal lines only.
- “ASCII_MARKDOWN”: Markdown format (ascii ellipses for truncated values).
- “MARKDOWN”: Markdown format (utf8 ellipses for truncated values).
- “UTF8_FULL”: UTF8, with all borders and lines, including row dividers.
- “UTF8_FULL_CONDENSED”: Same as UTF8_FULL, but with dense row spacing.
- “UTF8_NO_BORDERS”: UTF8, no borders.
- “UTF8_BORDERS_ONLY”: UTF8, borders only.
- “UTF8_HORIZONTAL_ONLY”: UTF8, horizontal lines only.
- “NOTHING”: No borders or other lines.
-
rounded_cornersbool -
Apply rounded corners to UTF8-styled tables (no-op for ASCII formats).
-
- Raises:
-
- ValueError: if format string not recognised.
Notes
The UTF8 styles all use one or more of the semigraphic box-drawing characters found in the Unicode Box Drawing block, which are not ASCII compatible: https://en.wikipedia.org/wiki/Box-drawing_character#Box_Drawing
Examples
>>> df = pl.DataFrame( ... {"abc": [-2.5, 5.0], "mno": ["hello", "world"], "xyz": [True, False]} ... ) >>> with pl.Config( ... tbl_formatting="MARKDOWN", ... tbl_hide_column_data_types=True, ... tbl_hide_dataframe_shape=True, ... ): ... print(df) | abc | mno | xyz | |------|-------|-------| | -2.5 | hello | true | | 5.0 | world | false |
classmethod Config.set_tbl_formatting(
format: Literal['ASCII_FULL',
'ASCII_FULL_CONDENSED',
'ASCII_NO_BORDERS',
'ASCII_BORDERS_ONLY',
'ASCII_BORDERS_ONLY_CONDENSED',
'ASCII_HORIZONTAL_ONLY',
'ASCII_MARKDOWN',
'MARKDOWN',
'UTF8_FULL',
'UTF8_FULL_CONDENSED',
'UTF8_NO_BORDERS',
'UTF8_BORDERS_ONLY',
'UTF8_HORIZONTAL_ONLY',
'NOTHING'] | None = None,
rounded_corners: bool | None = False,
) → type[Config]
© 2020 Ritchie Vink
© 2022 Polars contributors
Licensed under the MIT License.
https://docs.pola.rs/api/python/stable/reference/api/polars.Config.set_tbl_formatting.html