22 lines
817 B
Python
22 lines
817 B
Python
from concurrent.futures import ThreadPoolExecutor
|
|
from pathlib import Path
|
|
import pandas as pd
|
|
|
|
|
|
def process_file(name: Path):
|
|
"""Afficher les informations concernant un fichier .xlsx."""
|
|
dataframe = pd.read_excel(name)
|
|
print(f"{name.name:>30} : {len(dataframe)} enregistrements.")
|
|
|
|
if __name__ == '__main__':
|
|
# Parcourir les fichiers du projet à la recherche de fichiers XLSX
|
|
# Définir le chemin de départ à celui du projet (contenant le fichier requirements.txt)
|
|
path = Path(__file__)
|
|
while not (path / "requirements.txt").exists():
|
|
path = path.parent
|
|
# Parcourir tous les fichiers .xlsx récursivement
|
|
executor = ThreadPoolExecutor(max_workers=8)
|
|
futures = []
|
|
for result in path.rglob("*.xlsx"):
|
|
futures.append(executor.submit(process_file, result))
|