Fix: 2023 lot calculation

This commit is contained in:
Bertrand Benjamin 2024-03-13 21:06:23 +01:00
parent e2805f9af2
commit bfebd6b58a

View File

@ -23,9 +23,11 @@ def extract_cat(cat: pd.DataFrame):
def lot_naming(value):
if str(value).isnumeric():
return str(value).zfill(2)
return "PC"
try:
v = int(value)
except ValueError:
return "PC"
return str(v).zfill(2)
def trans_2017_2021(
@ -99,7 +101,7 @@ def trans_2023(
df = df.assign(
Débit=df["Débit"].fillna(0),
Crédit=df["Crédit"].fillna(0),
Lot=lot_naming(df["Porte"]),
Lot=df["Porte"].apply(lot_naming),
Année=year,
)
return df[stagging_columns]