polars.Config.set_tbl_formatting#
- 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', 'UTF8_FULL', 'UTF8_FULL_CONDENSED', 'UTF8_NO_BORDERS', 'UTF8_BORDERS_ONLY', 'UTF8_HORIZONTAL_ONLY', 'NOTHING'] | None = None,
- rounded_corners: bool = False,
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”: ASCII, Markdown compatible.
“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:
- KeyError: 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="ASCII_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 |