Expense Tracker With Graphs Using PictoBlox Python Editor
by karishmathakur in Design > Software
9 Views, 0 Favorites, 0 Comments
Expense Tracker With Graphs Using PictoBlox Python Editor
Managing money wisely is an important life skill. Keeping track of daily expenses helps individuals understand their spending habits and make better financial decisions. In this project, I developed an Expense Tracker with Graphs using the PictoBlox Python Editor (Py Editor). The application allows users to record their daily expenses, categorize them, analyze spending patterns, and visualize the data through graphs.
The project demonstrates the use of Python programming, data handling, and data visualization to create a practical solution for personal finance management.
Supplies
- PictoBlox
- Python Editor (Py Editor) in PictoBlox
- Python Libraries:
- pandas (for data handling)
- matplotlib (for graph generation)
Create the Expense Entry System
The first step is to create a system where users can enter:
- Date
- Expense Category
- Expense Amount
- Description (optional)
The program stores these details for further analysis.
Example Categories:
- Food
- Transportation
- Education
- Entertainment
- Shopping
- Utilities
- Others
Store and Organize Data
The entered expense data is stored in a structured format using Python data structures such as lists or dataframes.
This allows the program to:
- Retrieve records easily.
- Calculate totals.
- Group expenses by category.
- Generate reports.
Analyze the Expense Data
The program processes the stored information and calculates:
- Total Expenses
- Category-wise Expenses
- Highest Spending Category
- Average Daily Spending
This analysis helps users understand their financial habits.
Generate Graphs
Using Python visualization libraries, the expense data is converted into graphical charts.
Types of Graphs Used:
Bar Graph
Shows spending across different categories.
Pie Chart
Displays the percentage share of each category.
Line Graph
Shows spending trends over time.
These visualizations make financial data easier to understand.
Python Code
import pandas as pd
import matplotlib.pyplot as plt
# Step 1: Create empty list to store data
data = []
print("Expense Tracker")
print("Enter your expenses (type 'done' to finish)\n")
# Step 2: Take user input
while True:
date = input("Enter date (YYYY-MM-DD) or 'done': ")
if date.lower() == 'done':
break
category = input("Enter category (Food/Travel/Shopping/etc): ")
amount = float(input("Enter amount: "))
data.append([date, category, amount])
print("Expense added!\n")
# Step 3: Create DataFrame
df = pd.DataFrame(data, columns=["Date", "Category", "Amount"])
# Convert Date column to datetime
df["Date"] = pd.to_datetime(df["Date"])
# Step 4: Category-wise total
category_total = df.groupby("Category")["Amount"].sum()
# Step 5: Daily total
daily_total = df.groupby("Date")["Amount"].sum()
# Step 6: Find overspending category
max_category = category_total.idxmax()
max_amount = category_total.max()
print("\n Summary:")
print(category_total)
print(f"\n You are spending the most on: {max_category} (Rs. {max_amount})")
# Step 7: Pie Chart (Category-wise)
plt.figure()
category_total.plot(kind='pie', autopct='%1.1f%%')
plt.title("Category-wise Expense Distribution")
plt.ylabel("")
plt.show()
# Step 8: Line Graph (Daily Spending)
plt.figure()
daily_total.plot(kind='line', marker='o')
plt.title("Daily Expense Trend")
plt.xlabel("Date")
plt.ylabel("Amount (₹)")
plt.grid()
plt.show()