From 94f9192760e12fc957954fcf015fd5fd34b6c354 Mon Sep 17 00:00:00 2001 From: Colin Maudry Date: Wed, 6 Aug 2025 12:03:19 +0200 Subject: [PATCH] Affichage de source inconnue si source null #26 --- src/figures.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/figures.py b/src/figures.py index 51fa3a8..54e9140 100644 --- a/src/figures.py +++ b/src/figures.py @@ -69,6 +69,11 @@ def get_barchart_sources(lf: pl.LazyFrame, type_date: str): lf = lf.with_columns(pl.col(type_date).cast(pl.String).str.head(7)) lf = lf.group_by([type_date, "source"]).len() + lf = lf.with_columns( + pl.when(pl.col("source").is_null()).then( + pl.lit("Source inconnue").alias("source") + ) + ) lf = lf.sort(by=[type_date, "source"], descending=False) df: pl.DataFrame = lf.collect()