polars.Config.set_tbl_cell_alignment#

classmethod Config.set_tbl_cell_alignment(
format: Literal['LEFT', 'CENTER', 'RIGHT'],
) type[Config][source]#

Set table cell alignment.

Parameters:
formatstr
  • “LEFT”: left aligned

  • “CENTER”: center aligned

  • “RIGHT”: right aligned

Raises:
KeyError: if alignment string not recognised.

Examples

>>> df = pl.DataFrame(
...     {"column_abc": [1.0, 2.5, 5.0], "column_xyz": [True, False, True]}
... )
>>> pl.Config.set_tbl_cell_alignment("RIGHT")  
# ...
# shape: (3, 2)
# ┌────────────┬────────────┐
# │ column_abc ┆ column_xyz │
# │        --- ┆        --- │
# │        f64 ┆       bool │
# ╞════════════╪════════════╡
# │        1.0 ┆       true │
# │        2.5 ┆      false │
# │        5.0 ┆       true │
# └────────────┴────────────┘