Feat: rename first column of charges

This commit is contained in:
Bertrand Benjamin 2022-10-10 22:08:11 +02:00
parent 1153931b7f
commit 3e2a23fb86

View File

@ -22,6 +22,7 @@ def extract_charge(table):
.replace("", np.nan) .replace("", np.nan)
.dropna(subset=["Débits", "Crédits"], how="all") .dropna(subset=["Débits", "Crédits"], how="all")
) )
drop_index = df[ drop_index = df[
df["RECAPITULATIF DES OPERATIONS"].str.contains("TOTAUX", case=False) df["RECAPITULATIF DES OPERATIONS"].str.contains("TOTAUX", case=False)
| df["RECAPITULATIF DES OPERATIONS"].str.contains("Solde créditeur", case=False) | df["RECAPITULATIF DES OPERATIONS"].str.contains("Solde créditeur", case=False)
@ -50,14 +51,18 @@ def extract_charge(table):
} }
) )
df.columns.values[0] = "Fournisseur"
return df return df
def extract_remise_com(table): def extract_remise_com(table):
"""Extract "remise commercial" from first page""" """Extract "remise commercial" from first page"""
df = pd.DataFrame(table[1:], columns=table[0]).replace("", np.nan) df = pd.DataFrame(table[1:], columns=table[0]).replace("", np.nan)
return df[ df = df[
df["RECAPITULATIF DES OPERATIONS"].str.contains( df["RECAPITULATIF DES OPERATIONS"].str.contains(
"Remise commerciale gérance", case=False, na=False "Remise commerciale gérance", case=False, na=False
) )
] ]
df.columns.values[0] = "Fournisseur"
return df