polars.Config.set_tbl_width_chars#

classmethod Config.set_tbl_width_chars(width: int | None) type[Config][source]#

Set the maximum width of a table in characters.

Parameters:
widthint

Maximum table width in characters.

Examples

>>> df = pl.DataFrame(
...     {
...         "id": ["SEQ1", "SEQ2"],
...         "seq": ["ATGATAAAGGAG", "GCAACGCATATA"],
...     }
... )
>>> df
shape: (2, 2)
┌──────┬──────────────┐
│ id   ┆ seq          │
│ ---  ┆ ---          │
│ str  ┆ str          │
╞══════╪══════════════╡
│ SEQ1 ┆ ATGATAAAGGAG │
│ SEQ2 ┆ GCAACGCATATA │
└──────┴──────────────┘
>>> pl.Config.set_tbl_width_chars(12)  
>>> df
shape: (2, 2)
┌─────┬─────┐
│ id  ┆ seq │
│ --- ┆ --- │
│ str ┆ str │
╞═════╪═════╡
│ SEQ ┆ ATG │
│ 1   ┆ ATA │
│     ┆ AAG │
│     ┆ GAG │
│ SEQ ┆ GCA │
│ 2   ┆ ACG │
│     ┆ CAT │
│     ┆ ATA │
└─────┴─────┘