Fix: run pre-commit

This commit is contained in:
Bertrand Benjamin 2022-09-27 15:01:14 +02:00
parent ba96211923
commit a2ac6c3c88

View File

@ -1,8 +1,9 @@
import pandas as pd
import numpy as np
import pdfplumber
from pathlib import Path from pathlib import Path
import click import click
import numpy as np
import pandas as pd
import pdfplumber
def extract_situation_loc(table): def extract_situation_loc(table):
@ -50,8 +51,8 @@ def extract_charge(table):
.dropna(subset=["Débits"]) .dropna(subset=["Débits"])
) )
drop_index = df[ drop_index = df[
df["RECAPITULATIF DES OPERATIONS"].str.contains("TOTAUX", case=False) or df["RECAPITULATIF DES OPERATIONS"].str.contains("TOTAUX", case=False)
df["RECAPITULATIF DES OPERATIONS"].str.contains("solde", case=False) or df["RECAPITULATIF DES OPERATIONS"].str.contains("solde", case=False)
].index ].index
df.drop(drop_index, inplace=True) df.drop(drop_index, inplace=True)
return df return df
@ -97,6 +98,7 @@ def extract_save(pdf_file):
pdf = pdfplumber.open(pdf_file) pdf = pdfplumber.open(pdf_file)
extract_from_pdf(pdf, xls_charge, xls_locataire) extract_from_pdf(pdf, xls_charge, xls_locataire)
@click.command() @click.command()
@click.option("--pdf_file", help="Nom du fichier pdf", default="") @click.option("--pdf_file", help="Nom du fichier pdf", default="")
@click.option("--folder", help="Tous les fichiers dans folder", default="./") @click.option("--folder", help="Tous les fichiers dans folder", default="./")
@ -110,7 +112,5 @@ def pdf2xlsx(pdf_file, folder):
extract_save(pdf_file) extract_save(pdf_file)
if __name__ == "__main__": if __name__ == "__main__":
pdf2xlsx() pdf2xlsx()