Day 46 of 100 Days Coding Challenge: Python
I’ve been tinkering with this book tracker for almost five days now, and let me tell you—things are starting to look serious. Not “move-in-together” serious, but close. As the code grows chunkier, I’ve been extra cautious about how I add each new function. Rather than throwing in five features and hoping nothing explodes, I take the accountant’s route: one entry at a time, reconciled and balanced.
Why the sudden urge to filter by quarter? Well, in the world of corporate accounting—where I live and breathe—we worship the fiscal calendar. Quarterly reporting is practically a sacrament. Automotive manufacturers slow down in summer and December, and trust me, so do I (with a good fantasy novel in hand). But that’s just a hunch. I wanted cold, clean, spreadsheet-worthy evidence that I read more Gothic tales as leaves fall and pumpkins rise. Gut feeling isn’t GAAP-approved. So today, we brought seasonal analysis into the Book Tracker universe.
Today’s Motivation / Challenge
Today’s challenge was simple but essential: how do you filter your data like a pro and still keep your chart options open? I wanted to analyze my reading habits by year and season, just like I do with budgets and forecasts. This time, instead of revenue trends, I’m tracking fantasy epics and Gothic drama. Same logic. Less coffee.
Purpose of the Code (Object)
This update adds the ability to view genre summaries filtered by year and, optionally, by quarter. The user can pick a year (and a quarter if they want) and choose between a pie chart or a bar chart to visualize what they’ve been reading. It’s like a financial report, but for books—and it’s way more colorful.
AI Prompt:
“Add a menu option that lets the user filter the genre summary by year and quarter, and display the data in either a pie or bar chart based on their choice. Keep the code clean and beginner-friendly.”
Functions & Features
- Lets users filter reading data by year and quarter
- Visualizes genre distribution as either a pie chart or bar chart
- Builds on existing color-coded genre system
- Detects invalid input and guides the user gently (and politely)
Requirements / Setup
pip install pandas matplotlib
Python 3.9 or later recommended for date handling and plotting.
Minimal Code Sample
year = int(input(“Enter year to analyze: “).strip())
df = df[df[‘Date Finished’].dt.year == year]
quarter_input = input(“Enter quarter (1–4) or press Enter to skip: “).strip()
if quarter_input:
df = df[df[‘Date Finished’].dt.quarter == int(quarter_input)]
This snippet filters your book log by the chosen year and optional quarter.
Notes / Lessons Learned
The more I add features, the more I see the architecture underneath the code. This little book tracker has evolved into a proper app—with clearly separated layers: imports, genre definitions, graphing logic, and menu options. Honestly, that’s kind of magical. It’s like finally understanding how your espresso machine works after years of just pressing the button.
There’s a quiet thrill in building something you actually want to use. This wasn’t just another tutorial—I created a tool tailored to my reading life. And somewhere between bug-fixing and plotting pie charts, I realized: 46 days in, I’ve gone from curious coder to confident tinkerer. Not bad for someone who thought Python was just a snake when this all started.
Optional Ideas for Expansion
- Add filters for author or language (in case you read in multiple languages)
- Include average pages per genre per quarter to see which genres exhaust you
- Export filtered results as a CSV report for sharing or archiving
