Spec-Zone.ru › Polars

polars.Config.set_trim_decimal_zeros

classmethod Config.set_trim_decimal_zeros(
    active: bool | None = True,
) → type[Config]

Удаляет завершающие нули из значений типа данных Decimal.

Параметры:
activebool

Включает удаление завершающих символов «0» из значений Decimal.

Примеры

>>> from decimal import Decimal as D
>>> df = pl.DataFrame(
...     data={"d": [D("1.01000"), D("-5.67890")]},
...     schema={"d": pl.Decimal(scale=5)},
... )
>>> with pl.Config(trim_decimal_zeros=False):
...     print(df)
shape: (2, 1)
┌───────────────┐
│ d             │
│ ---           │
│ decimal[38,5] │
╞═══════════════╡
│ 1.01000       │
│ -5.67890      │
└───────────────┘
>>> with pl.Config(trim_decimal_zeros=True):
...     print(df)
shape: (2, 1)
┌───────────────┐
│ d             │
│ ---           │
│ decimal[38,5] │
╞═══════════════╡
│ 1.01          │
│ -5.6789       │
└───────────────┘

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

Spec-Zone.ru

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