Slicing Up Genres (With Pie, Not Precision Tools)

Day 44 of 100 Days Coding Challenge: Python

Yesterday’s mission? Make a colorful genre-based bar chart that didn’t look like a monochrome mess. After some wrestling with the code (and maybe whispering a few stern words to matplotlib), I decided to step back and take a wiser approach—add one function at a time. Think of it like seasoning a dish: too many spices at once and you can’t tell if the problem is the salt or the cinnamon.

So today, instead of fixing every chart in one go, I added something deliciously simple: a pie chart. Not the edible kind, unfortunately, but a visual feast for genre distribution. It’s a nice way to get a bird’s-eye view of what I’ve been reading—am I balanced, or living in a fantasy bubble? This project is starting to feel like a real book journal app, and that’s both exciting and mildly terrifying.

Today’s Motivation / Challenge


Histograms are great if you’re obsessed with dates (hi, it’s me), but sometimes you just want to know what you’ve been feeding your literary diet. A pie chart offers a big-picture summary of your reading preferences—like stepping back from the bookshelf and realizing 60% of it is purple dragon covers. Today’s goal? See the forest, not just the monthly genre trees.

Purpose of the Code (Object)


This updated code adds a neat little pie chart showing the proportion of each genre in your reading log. It uses the data already stored in your CSV file and the color settings from yesterday’s code. The result? A clean visual breakdown of your book habits, so you can brag about how “diverse” your library is—or realize it’s time to mix in something besides historical fiction.

AI Prompt:


Make it readable. Make it modular. And for the love of Python, add one feature at a time.

Functions & Features

  • Add books to a CSV file with metadata like title, author, pages, and genre
  • Show reading progress over time (bar chart by month and genre)
  • View genre-specific reading patterns
  • Display a pie chart of your overall genre distribution
  • Import book lists from another CSV file

Requirements / Setup

  • Python 3.x

Install the required library:

pip install matplotlib pandas

Minimal Code Sample

def plot_genre_distribution():

    df = pd.read_csv(FILE_NAME)

    df[‘Genre’] = df[‘Genre’].str.strip().str.title()

    genre_counts = df[‘Genre’].value_counts()

    colors = [GENRE_COLORS.get(g, ‘gray’) for g in genre_counts.index]

    plt.pie(genre_counts, labels=genre_counts.index, colors=colors, autopct=’%1.1f%%’)

    plt.title(‘Overall Genre Distribution’)

    plt.axis(‘equal’)

    plt.tight_layout()

    plt.show()

This function creates a genre pie chart based on the books you’ve read.

Book Tracker

Notes / Lessons Learned


What I added today was the code to create a pie chart, showing the distribution of genres. Then, I gave it a shiny new menu option. It worked surprisingly smoothly—probably because I didn’t try to fix five other things at the same time.

I’m finally getting used to virtual environments, which means fewer self-inflicted typos and wild goose chases through the wrong folders. The genre color dictionary I built yesterday made the pie chart almost too easy. That’s a nice surprise in coding: sometimes past-you actually set present-you up for success.

Also, here’s a bit of wisdom from building queries in SAP (and now in Python): change one thing at a time. If you break something, at least you know which line of code betrayed you.

Optional Ideas for Expansion

  • Let users toggle between the pie chart and the bar chart from the same menu
  • Allow subgenre tracking with drill-down options
  • Export the pie chart as an image to share or embed in a blog

Graphing My Way Through the Library With A Book Tracker App

Day 41 of 100 Days Coding Challenge: Python

Book Tracker Program (Day 41 – Day54)

I moved on from absolute-beginner apps to something a little more demanding. Over the past two weeks, most of what I built wasn’t flashy—it was practical. These small apps were about learning the exact functions I actually need.

The file organizer, for example, solves a very real problem: keeping files consistently formatted instead of turning my folders into abstract art. The PDF merger came from pure necessity. My scanner insists on scanning one page at a time, and finding a decent free merger online—one that doesn’t ask me to upload tax documents to the internet gods—turned out to be surprisingly difficult.

That’s when it clicked. With Python—and a bit of help from AI—I can build these functions myself. No subscriptions, no privacy risks, no compromises. So I decided to aim slightly higher and work on an app connected to something I genuinely care about. For my first “real” project, I chose a Book Tracker Program—because if I’m going to code for hours, it might as well involve books.

Introduction

I love reading. My idea of a good time is curling up with a 1,000-page fantasy epic and thinking, Yes, this is how I’ll spend the next two weeks. Naturally, the data nerd in me can’t resist tracking my progress. I’ve used everything from Excel spreadsheets to a system I call “Analog Notion” (also known as a notebook) to log my reads. But now I want more—stats, graphs, the whole dashboard treatment. I’ve seen those beautiful book journals online with charts showing how many pages were devoured each month, and I thought, “Why not me?” Today’s project is a humble beginning: a simple book tracker App in Python. It’s nowhere near as pretty as those Instagram-worthy bullet journals, but it’s a start. And hey, if Brandon Sanderson can write 400,000 words in a single book, I can write a few lines of code to track it.

Today’s Motivation / Challenge

Every January, I wonder how many books I actually read last year, and how many times I reread Mistborn instead of trying something new. This little tool is my attempt to turn that curiosity into data—and maybe guilt myself into broadening my literary horizons. Also, it’s a good excuse to code something that feels both nerdy and delightfully personal.

Purpose of the Code (Object)

This script lets you log the books you’ve finished, track how many pages you’ve read, and generate a basic bar chart showing your monthly reading habits. It’s not fancy yet, but it turns your pile of finished books into pretty bars on a graph—which is basically visual applause.

AI Prompt:

Write a Python script that logs books read (title, author, pages, and date finished), stores them in a CSV file, and displays a monthly bar graph of pages read using pandas and matplotlib.

Functions & Features

  • Add a finished book to your reading log
  • View your full list of logged books
  • Display a graph of how many pages you read per month

Requirements / Setup

pip install pandas matplotlib

Python 3.7+ is recommended (though any recent version should work).

Minimal Code Sample

df[‘Month’] = df[‘Date Finished’].dt.to_period(‘M’)

monthly_stats = df.groupby(‘Month’)[‘Pages’].sum()

monthly_stats.plot(kind=’bar’)

This groups books by month and creates a bar chart of pages read.

Book Tracker

Notes / Lessons Learned

Let me tell you the saga of activating a virtual environment in PowerShell. It started, as all good tales do, with an error message claiming the activation script didn’t exist—even though I was staring right at it. After the usual ritual of Set-ExecutionPolicy RemoteSigned -Scope CurrentUser, and trying the exact same command three times, it suddenly worked. I have no explanation. It was like summoning a reluctant ghost. Once I got the environment running, I entered four books from my holiday reading binge (December 23 – January 1). Manually. One by one. It’s not glamorous. The graph? Let’s call it “functional minimalism.” This is a bare-bones tool for now, but it has potential. Someday, I’d love to feed it directly from my Notion log and automate the whole thing. Until then, I type.

Optional Ideas for Expansion

  • Import book data automatically from a Notion export or CSV
  • Add genre filters to visualize trends (e.g., “Too much fantasy?”)
  • Track time spent reading, not just pages