Sub topic 10
Compare planned time with actual time
This chapter assumes you have a cleaned seven-day log in the CSV format from earlier chapters, and that you have already totaled hours by category. You also need a plan to compare against. If you did not write one, the chapter shows how to build one after the fact.
Why compare plan with actual
Totals by category tell you where time went. They do not tell you whether that is a problem. A 20% share for meetings might be fine or might be double what you expected. The gap between plan and actual is what turns a total into a finding.
Your audit goal sets what "planned" means. If your question was "Why do I never finish deep work?", the plan is how many deep work hours you intended to have. If your question was about overall balance, the plan is your intended hours for every category.
Get a planned number for each category
Use one of these sources, in order of preference:
- A plan written before the week. Best, because it is not influenced by what happened.
- Your calendar and to-do list. Count blocks you scheduled, such as a two-hour focus block on Tuesday.
- A guess made before looking at the totals. Write one estimate per category, in hours, before you read your results. A guess made after seeing the numbers is biased.
Keep the plan in a second CSV with one row per category.
category,planned_hours
deep_work,12
communication,5
meetings,6
admin,3Calculate the gap
For each category, compute the difference and the ratio.
- Gap is actual hours minus planned hours. A positive gap means you spent more time than planned.
- Ratio is actual divided by planned. A ratio of 0.5 means you got half of what you planned.
This script reads both files and prints the comparison. It assumes no log entry crosses midnight, and every logged category has a planned row.
import csv
from collections import defaultdict
from datetime import datetime
actual = defaultdict(float)
with open("time_log.csv", newline="") as f:
for row in csv.DictReader(f):
start = datetime.strptime(row["start"], "%H:%M")
end = datetime.strptime(row["end"], "%H:%M")
actual[row["category"]] += (end - start).total_seconds() / 3600
planned = {}
with open("plan.csv", newline="") as f:
for row in csv.DictReader(f):
planned[row["category"]] = float(row["planned_hours"])
print(f"{'category':<15}{'planned':>8}{'actual':>8}{'gap':>8}{'ratio':>8}")
for category in sorted(planned, key=lambda c: actual[c] - planned[c], reverse=True):
gap = actual[category] - planned[category]
ratio = actual[category] / planned[category]
print(f"{category:<15}{planned[category]:>8.1f}{actual[category]:>8.1f}{gap:>+8.1f}{ratio:>8.2f}")Because actual is a defaultdict, a planned category with no log entries shows 0.0 hours instead of raising an error. A category in the log but missing from the plan is silently left out, so check that the two files use the same names.
Read the result
A table of gaps is easy to over-read. Apply these checks.
- Look at size, not just direction. A gap of +0.3 hours over a week is noise. A gap of +4 hours is a finding.
- Check the ratio for small categories. Two extra hours on a 3-hour admin plan (ratio 1.67) matters more than two extra hours on a 12-hour plan (ratio 1.17).
- Remember the time zero-sum. If one category runs over, others usually run under. Look for the pair, such as meetings up and deep work down.
- Check the log's coverage. If the log covers only 38 of your 45 working hours, a category that looks under plan may just be unlogged time.
Common errors
- Planning in a different unit. Plan in hours per week, the same unit as your totals. Mixing days and weeks produces ratios that look dramatic but mean nothing.
- Changing the plan afterward. If the plan is edited once you see the results, the comparison only confirms what you already believe.
- Treating the plan as correct. A large gap may mean the plan was unrealistic, not that you failed. Note that possibility next to each large gap.
Exercise
Your plan was 10 hours of deep work and the log shows 4. Meetings were planned at 5 hours and the log shows 9. The log covers 36 of 40 working hours. What are the gap and ratio for deep work, and what should you check before concluding that meetings took the deep work time?
Show answer
The deep work gap is 4 - 10 = -6 hours and the ratio is 4 / 10 = 0.40. Meetings are +4 hours over plan, which nearly matches part of the deep work shortfall. Before concluding that meetings replaced deep work, check the 4 unlogged hours, since some of the missing deep work may be there, and look at the days where the two categories moved in opposite directions.