Given a CSV file containing the spending data in the format mentioned in the example, it calculates and shows spending trends and graphs.
This python code loads the CSV file and creates a pandas dataframe. Then it splits the date column into year, month, and day. It groups the data by month and calculates the sum of income and expense. Then it plots the data into three different graphs.
The first graph plots the monthly income and expenses. The second graph plots the cumulative monthly income and expense and the third graph plots the total spending by category.
Sample File Link to download: https://docs.google.com/spreadsheets/d/1-yEy0-8qSeYNK6OVmBjYEkapGDxm5o97emaYl3QY77E/edit?usp=sharing
Date,Account,Category,Note,Income/Expense,Amount
3/2/2022 10:11,CUB - online payment,Food,Brownie,Expense,50
3/2/2022 10:11,CUB - online payment,Other,To lended people,Expense,300
3/1/2022 19:50,CUB - online payment,Food,Dinner,Expense,78
3/1/2022 18:56,CUB - online payment,Transportation,Metro,Expense,30
3/1/2022 18:22,CUB - online payment,Food,Snacks,Expense,67
3/1/2022 18:22,CUB - online payment,Other,From vicky,Income,100
3/1/2022 18:21,CUB - online payment,Other,From dad,Income,500
2/28/2022 11:56,CUB - online payment,Food,Pizza,Expense,339.15
2/28/2022 11:45,CUB - online payment,Other,From kumara,Income,200
'Date', 'Category', 'Income/Expense', 'Amount'
Copyright © MecSimCalc 2025
Terms | Privacy