Affichage de source inconnue si source null #26

This commit is contained in:
Colin Maudry
2025-08-06 12:03:19 +02:00
parent f490e099ea
commit 94f9192760
+5
View File
@@ -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()