Skip to content
Hands-on Mentor
ENTR
Back to blog

How to track income and expenses with a simple table and Python

Track income and expenses by recording each item with a date, category and amount. Build a table, summarize by category, compare with a budget. No app needed.

4 min read

To track income and expenses, write down every item with a date, a category, and an amount, then summarize the list on a regular schedule. A budget plans where your money will go. Tracking shows where it actually went. When you compare the two, you can see which category went over plan. You can do this in a notebook, a spreadsheet, or a few lines of Python. You do not need an app.

What should an expense tracking spreadsheet include?

Four columns are enough:

ColumnExample
date2026-11-03
categoryFood
descriptionGroceries
amount-22.50

Write expenses as negative numbers and income as positive. Then the sum is the money left. Keep the categories few and clear, for example: Housing, Food, Transport, Fun, Education, Other, Income.

How do you track a month of spending?

Here is a month of records for a student:

import pandas as pd

records = pd.DataFrame({
    "date": ["2026-11-01", "2026-11-01", "2026-11-03", "2026-11-05",
             "2026-11-08", "2026-11-12", "2026-11-15", "2026-11-20",
             "2026-11-22", "2026-11-28"],
    "category": ["Income", "Housing", "Food", "Transport", "Fun",
                 "Food", "Income", "Fun", "Food", "Education"],
    "description": ["Allowance", "Rent", "Groceries", "Bus pass", "Movie night",
                    "Groceries", "Part-time work", "Concert ticket", "Groceries", "Textbook"],
    "amount": [500, -175, -22.5, -40, -30, -26, 100, -45, -24, -17.5],
})

print(records["amount"].sum())

The result is 220.0, so income is $220.00 higher than spending this month. Keep the description column in your own records. Three months from now it answers the question "What was that $45?"

How much of your income is left?

income = records[records["amount"] > 0]["amount"].sum()
left = records["amount"].sum()
print(income, round(left / income * 100, 1))

The output is 600.0 36.7. Of $600.00 income, 36.7% was not spent. If that looks high, check your records first. Often the reason is spending you forgot to write down.

How do you categorize expenses?

Group the expenses and add up each category:

expenses = records[records["amount"] < 0]
summary = expenses.groupby("category")["amount"].sum().abs().sort_values(ascending=False)
print(summary)
print((summary / summary.sum() * 100).round(1))
categoryamountshare
Housing$175.0046.1%
Fun$75.0019.7%
Food$72.5019.1%
Transport$40.0010.5%
Education$17.504.6%

Total spending is $380.00. Housing is the biggest item, as expected. But Fun is higher than Food. Two small fun costs ($30 and $45) add up to the second-largest category. A summary table makes this visible. To learn more about grouping, read [pandas groupby explained](/blog/pandas-groupby).

How do you compare tracking with a budget?

budget = pd.Series({"Housing": 175, "Food": 100, "Transport": 40,
                    "Fun": 50, "Education": 25})
difference = (summary - budget).fillna(-budget)
print(difference.sort_values(ascending=False))

The output:

category
Fun          25.0
Transport     0.0
Housing       0.0
Education    -7.5
Food        -27.5
dtype: float64

A positive number means you spent more than planned. A negative number means you spent less. Here Fun went $25.00 over, and Food was $27.50 under. The fillna(-budget) part handles a category that is in the budget but had no spending: it shows the whole budget as unspent instead of leaving a blank. Next month you can raise the Fun budget or spend less. Both are conscious choices.

How can you track spending without an app?

  • Record it the same day. If you wait until the weekend, you forget.
  • Use your bank statement. At the end of the month, check card payments against it.
  • Spend 5 minutes a week. Look over the records and fix categories.
  • Python is optional. A notebook or a spreadsheet works the same way. What matters is the weekly habit.
  • You do not have to be perfect. Forgetting a $2 item is fine. You want the big picture.

What will you learn from tracking?

After two or three months of tracking, you will:

  • Know your average monthly spending and which months cost more.
  • See the small "leaks": little costs that happen often.
  • Build your budget from real data, not from guesses.

What mistakes should you avoid?

  • Too many categories. Twenty categories make tracking hard. Six to eight is enough.
  • Writing only big costs. Small costs add up to a lot.
  • Recording but never summarizing. Data helps only when you look at it.
  • Mixing up the signs. If you write an expense as a positive number, the total is wrong.

What to read next

The course page for [Economics and Finance](/courses/economics-finance) has the full set of lessons, including [Income, expenses and net position](/learn/economics-finance/income-expenses-net-position) and [Needs, wants and tracking](/learn/economics-finance/needs-wants-tracking). Use your monthly totals to build an [emergency fund](/blog/emergency-fund), and read [How to build a saving habit](/blog/saving-habit) to plan how much to set aside.

*This article is not investment advice.*

  • #personal finance
  • #expense tracking
  • #pandas
  • #budget
All posts