Spec-Zone.ru › Polars

polars.Config.set_fmt_str_lengths

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

Задаёт количество символов, отображаемых в строковых значениях.

Параметры:
nint

Количество отображаемых символов.

Примеры

>>> df = pl.DataFrame(
...     {
...         "txt": [
...             "Play it, Sam. Play 'As Time Goes By'.",
...             "This is the beginning of a beautiful friendship.",
...         ]
...     }
... )
>>> df.with_columns(pl.col("txt").str.len_bytes().alias("len"))
shape: (2, 2)
┌─────────────────────────────────┬─────┐
│ txt                             ┆ len │
│ ---                             ┆ --- │
│ str                             ┆ u32 │
╞═════════════════════════════════╪═════╡
│ Play it, Sam. Play 'As Time Go… ┆ 37  │
│ This is the beginning of a bea… ┆ 48  │
└─────────────────────────────────┴─────┘
>>> with pl.Config(fmt_str_lengths=50):
...     print(df)
shape: (2, 1)
┌──────────────────────────────────────────────────┐
│ txt                                              │
│ ---                                              │
│ str                                              │
╞══════════════════════════════════════════════════╡
│ Play it, Sam. Play 'As Time Goes By'.            │
│ This is the beginning of a beautiful friendship. │
└──────────────────────────────────────────────────┘

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

Spec-Zone.ru

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