From c0c02cedfb0a276c6ba85d981d19809804896296 Mon Sep 17 00:00:00 2001 From: A R R R Associates Date: Mon, 13 Jul 2026 10:38:25 +0530 Subject: [PATCH] Fix bank analyzer Excel export for current pandas --- .../bank_statement_analyzer/analyzer.py | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/modules/bank_statement_analyzer/analyzer.py b/app/modules/bank_statement_analyzer/analyzer.py index 14bbddc..4a8b623 100644 --- a/app/modules/bank_statement_analyzer/analyzer.py +++ b/app/modules/bank_statement_analyzer/analyzer.py @@ -3,7 +3,7 @@ from pathlib import Path import re import pandas as pd from .parsers import parse_pdf -from .parsers.common import infer_mode +from parsers.common import infer_mode def clean_key(s): @@ -80,22 +80,22 @@ def export_excel(output,metas,all_df,unique_df): ['Total Credit (Unique)',float(unique_df.credit.sum()) if not unique_df.empty else 0], ],columns=['Metric','Value']) with pd.ExcelWriter(output,engine='xlsxwriter',datetime_format='dd-mmm-yyyy') as w: - dashboard.to_excel(w,'Dashboard',index=False) - recon.to_excel(w,'Statement Reconciliation',index=False) - all_df.to_excel(w,'All Extracted Rows',index=False) - unique_df.to_excel(w,'Unique Transactions',index=False) - all_df[all_df.exact_duplicate].to_excel(w,'Exact Duplicates',index=False) - all_df[all_df.possible_duplicate].to_excel(w,'Possible Duplicates',index=False) - monthly_summary(unique_df).to_excel(w,'Monthly Summary',index=False) - mode_summary(unique_df).to_excel(w,'Mode Summary',index=False) - duplicate_summary(all_df).to_excel(w,'Duplicate Summary',index=False) + dashboard.to_excel(w, sheet_name='Dashboard', index=False) + recon.to_excel(w, sheet_name='Statement Reconciliation', index=False) + all_df.to_excel(w, sheet_name='All Extracted Rows', index=False) + unique_df.to_excel(w, sheet_name='Unique Transactions', index=False) + all_df[all_df.exact_duplicate].to_excel(w, sheet_name='Exact Duplicates', index=False) + all_df[all_df.possible_duplicate].to_excel(w, sheet_name='Possible Duplicates', index=False) + monthly_summary(unique_df).to_excel(w, sheet_name='Monthly Summary', index=False) + mode_summary(unique_df).to_excel(w, sheet_name='Mode Summary', index=False) + duplicate_summary(all_df).to_excel(w, sheet_name='Duplicate Summary', index=False) notes=pd.DataFrame({'Notes':[ 'Exact duplicates use transaction date, value date, debit, credit, balance and normalized narration.', 'Possible duplicates use same date, direction, amount and normalized narration; review before deletion.', 'Bank-specific parsers are selected automatically. Customer name/account number can be manually overridden in the app.', 'The workbook is a bank-statement analysis aid, not a substitute for ledger, GST, inventory, receivable/payable and cash-book records.' ]}) - notes.to_excel(w,'Notes',index=False) + notes.to_excel(w, sheet_name='Notes', index=False) wb=w.book head=wb.add_format({'bold':True,'bg_color':'#1F4E78','font_color':'white','border':1}) money=wb.add_format({'num_format':'#,##0.00'})