Fix: smarter exclusion in charge

This commit is contained in:
Bertrand Benjamin 2022-09-28 20:49:58 +02:00
parent fc15bb8303
commit 67bea5b9b4
1 changed files with 4 additions and 1 deletions

View File

@ -6,6 +6,8 @@ import pandas as pd
def extract_charge(table):
"""From pdfplumber table extract the charge dataframe"""
for l in table:
print(l)
df = (
pd.DataFrame(table[1:], columns=table[0])
.replace("", np.nan)
@ -13,7 +15,8 @@ def extract_charge(table):
)
drop_index = df[
df["RECAPITULATIF DES OPERATIONS"].str.contains("TOTAUX", case=False)
| df["RECAPITULATIF DES OPERATIONS"].str.contains("solde", case=False)
| df["RECAPITULATIF DES OPERATIONS"].str.contains("Solde créditeur", case=False)
| df["RECAPITULATIF DES OPERATIONS"].str.contains("Solde débiteur", case=False)
].index
df.drop(drop_index, inplace=True)