polars.Config.set_fmt_table_cell_list_len#

classmethod Config.set_fmt_table_cell_list_len(n: int | None) type[Config][source]#

Set the number of elements to display for List values.

Empty lists will always print “[]”. Negative values will result in all values being printed. A value of 0 will always “[…]” for lists with contents. A value of 1 will print only the final item in the list.

Parameters:
nint

Number of values to display.

Examples

>>> df = pl.DataFrame(
...     {
...         "nums": [
...             [1, 2, 3, 4, 5, 6],
...         ]
...     }
... )
>>> df
shape: (1, 1)
┌─────────────┐
│ nums        │
│ ---         │
│ list[i64]   │
╞═════════════╡
│ [1, 2, … 6] │
└─────────────┘
>>> with pl.Config(fmt_table_cell_list_len=10):
...     print(df)
shape: (1, 1)
┌────────────────────┐
│ nums               │
│ ---                │
│ list[i64]          │
╞════════════════════╡
│ [1, 2, 3, 4, 5, 6] │
└────────────────────┘