Skip to content

Instantly share code, notes, and snippets.

@samirsaci
Created April 27, 2021 14:59
Show Gist options
  • Select an option

  • Save samirsaci/883115a15770ecf4c4547bd064e66457 to your computer and use it in GitHub Desktop.

Select an option

Save samirsaci/883115a15770ecf4c4547bd064e66457 to your computer and use it in GitHub Desktop.
Accounting Automation
import pandas as pd
# Dictionnary of filenames
list_files = ['DC-JAN-2017.xlsx', 'DC-FEB-2017.xlsx', 'DC-MAR-2017.xlsx','DC-APR-2017.xlsx', 'DC-MAY-2017.xlsx', 'DC-JUN-2017.xlsx',
'DC-JUL-2017.xlsx', 'DC-AUG-2017.xlsx', 'DC-SEP-2017.xlsx','DC-OCT-2017.xlsx', 'DC-NOV-2017.xlsx', 'DC-DEC-2017.xlsx']
zip_loop = zip(list_files, [i[3:6] for i in list_files])
# Final report DataFrame
df_report = pd.DataFrame()
for file_name, month in zip_loop:
# Import and Clean Data
df_clean = clean(file_raw, month)
# Build Monthly report
df_month = process_month(df_clean, month)
# Merge with previous Months report
if df_report.empty
df_report = df_month
else:
df_report = df_report.merge(df_month, on = 'index')
# Save Final Report
df_report.to_excel('Final Report.xlsx')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment