From 1ab5c639f002c57fe2b04bec367ff1019dac29f2 Mon Sep 17 00:00:00 2001 From: Colin Maudry Date: Tue, 24 Jun 2025 15:02:53 +0200 Subject: [PATCH] =?UTF-8?q?lf=20=3D>=20lff=20pour=20=C3=A9viter=20un=20con?= =?UTF-8?q?flit=20avec=20le=20lf=20global?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/utils.py b/src/utils.py index 7221873..b12966b 100644 --- a/src/utils.py +++ b/src/utils.py @@ -37,8 +37,8 @@ def split_filter_part(filter_part): return [None] * 3 -def add_annuaire_link(df: pl.LazyFrame): - df = df.with_columns( +def add_annuaire_link(dff: pl.LazyFrame): + dff = dff.with_columns( pl.when(pl.col("titulaire_typeIdentifiant") == "SIRET") .then( pl.col("titulaire_id") @@ -49,7 +49,7 @@ def add_annuaire_link(df: pl.LazyFrame): .otherwise(pl.col("titulaire_id")) .alias("titulaire_id") ) - df = df.with_columns( + dff = dff.with_columns( ( pl.col("acheteur_id") + ' 📑' ).alias("acheteur_id") ) - return df + return dff -def booleans_to_strings(lf: pl.LazyFrame) -> pl.LazyFrame: +def booleans_to_strings(lff: pl.LazyFrame) -> pl.LazyFrame: """ Convert all boolean columns to string type. """ - lf = lf.with_columns( + lff = lff.with_columns( pl.col(cs.Boolean) .cast(pl.String) .str.replace("true", "oui") .str.replace("false", "non") ) - return lf + return lff -def numbers_to_strings(lf: pl.LazyFrame) -> pl.LazyFrame: +def numbers_to_strings(lff: pl.LazyFrame) -> pl.LazyFrame: """ Convert all numeric columns to string type. """ - lf = lf.with_columns(pl.col(pl.Float64, pl.Int16).cast(pl.String).fill_null("")) - return lf + lff = lff.with_columns(pl.col(pl.Float64, pl.Int16).cast(pl.String).fill_null("")) + return lff def format_number(number) -> str: