Spec-Zone.ru › Polars

polars.Config.set_fmt_table_cell_list_len

classmethod Config.set_fmt_table_cell_list_len(
    n: int | None,
) → type[Config]

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] │
└────────────────────┘

© 2020 Ritchie Vink
© 2022 Polars contributors
Licensed under the MIT License.
https://docs.pola.rs/api/python/stable/reference/api/polars.Config.set_fmt_table_cell_list_len.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API