From 65e0f4c5f0d32c0d194ee4c77b7e1ca3e0d96db8 Mon Sep 17 00:00:00 2001 From: Colin Maudry Date: Fri, 10 Oct 2025 18:25:08 +0200 Subject: [PATCH] Gestion des montants inexistants --- src/utils.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/utils.py b/src/utils.py index e200c91..d73a6a0 100644 --- a/src/utils.py +++ b/src/utils.py @@ -145,7 +145,13 @@ def format_montant(dff: pl.DataFrame) -> pl.DataFrame: .otherwise(pl.lit("")) ) - return num + frac + pl.lit(" €") + montant: pl.Expr = ( + pl.when((num + frac) == pl.lit("")) + .then(pl.lit("")) + .otherwise(num + frac + pl.lit(" €")) + ) + + return montant dff = dff.with_columns(pl.col("montant").pipe(format_function).alias("montant")) return dff