polars.Config.set_trim_decimal_zeros#
- classmethod Config.set_trim_decimal_zeros(active: bool | None = True) type[Config] [source]#
Strip trailing zeros from Decimal data type values.
- Parameters:
- activebool
Enable stripping of trailing ‘0’ characters from Decimal values.
Examples
>>> from decimal import Decimal as D >>> df = pl.DataFrame( ... data={"d": [D("1.01"), D("-5.6789")]}, ... schema={"d": pl.Decimal(scale=5)}, ... ) >>> with pl.Config(trim_decimal_zeros=False): ... print(df) shape: (2, 1) ┌──────────────┐ │ d │ │ --- │ │ decimal[*,5] │ ╞══════════════╡ │ 1.01000 │ │ -5.67890 │ └──────────────┘ >>> with pl.Config(trim_decimal_zeros=True): ... print(df) shape: (2, 1) ┌──────────────┐ │ d │ │ --- │ │ decimal[*,5] │ ╞══════════════╡ │ 1.01 │ │ -5.6789 │ └──────────────┘