Networks & Simulations

Mapping the World of Wine — Network Analysis

Apr 2025

Python network analysis of WineEnthusiast reviews. Builds country–variety and hierarchical networks to surface regional patterns and influence structures across the wine world.

Solo NetworkX PageRank Network Analysis
Project Overview

• Network analysis of wine reviews and regional patterns
• Country–variety bipartite networks
• Hierarchical network construction
• PageRank for influence ranking

Data & File Analysis

Music Analyzer

2025

iTunes music library analysis tool. Parse and analyze music metadata including genre statistics, play history, longest/shortest songs, and release year trends from exported iTunes library files.

File Processing Data Analysis Dictionaries Text Parsing
Features

• Parse UTF-16 encoded iTunes library exports
• Calculate total songs and play statistics
• Group songs by release year
• Analyze by genre (count, longest/shortest songs)
• Track played vs unplayed songs

music_analyzer.py (excerpt)
def analyze_by_genre(songs_data):
    genre_stats = {}

    for song in songs_data:
        genre = song.get("Genre", "").strip()
        if genre:
            time_length = int(song["Time"]) if song["Time"] else 0

            if genre not in genre_stats:
                genre_stats[genre] = {
                    "count": 0,
                    "longest": {"songs": [], "length": 0},
                    "shortest": {"songs": [], "length": float("inf")}
                }
            
            genre_stats[genre]["count"] += 1

            # Track longest song
            if time_length > genre_stats[genre]["longest"]["length"]:
                genre_stats[genre]["longest"]["length"] = time_length
                genre_stats[genre]["longest"]["songs"] = [{"Name": song["Name"]}]

            # Track shortest song
            if time_length < genre_stats[genre]["shortest"]["length"]:
                genre_stats[genre]["shortest"]["length"] = time_length
                genre_stats[genre]["shortest"]["songs"] = [{"Name": song["Name"]}]

    for genre, stats in genre_stats.items():
        print(f"Genre: {genre}")
        print(f"Number of songs: {stats['count']}")
        if stats["longest"]["songs"]:
            for song in stats["longest"]["songs"]:
                print(f"Longest: {song['Name']}")
Practical Applications

Flooring Cost Estimator

2025

Interactive calculator for tile flooring installation costs. Calculates material costs (boxes of tiles) and labor charges based on floor dimensions, tile price, and hourly labor rate with comprehensive input validation.

Input Validation Math Operations Error Handling User Interface
Calculation Logic

• Square footage: length × width
• Boxes needed: ⌈sq ft ÷ 25⌉ (using math.ceil)
• Labor hours: (sq ft ÷ 50) × 1.5
• Total cost: (boxes × price/box) + (hours × labor rate)
• Comprehensive input validation with try/except

flooringestimator.py
import math

def flooring_estimator():
    print("Welcome. The program estimates the cost of a tile flooring installation")

    do_estimation = True
    while do_estimation:
        
        while True:
            try:
                length = float(input("Enter the length of the floor (in feet): "))
                if length <= 0:
                    print("It must be a positive value. Try again.")
                    continue
            except ValueError:
                print("Please enter a numeric value.")
            else:
                break

        while True:
            try:
                width = float(input("Enter the width of the floor (in feet): "))
                if width <= 0:
                    print("It must be a positive value. Try again.")
                    continue
            except ValueError:
                print("Please enter a numeric value.")
            else:
                break

        total_square_footage = length * width
        boxes_of_tiles = math.ceil(total_square_footage / 25)  
        hours_of_labor = (total_square_footage / 50) * 1.5
        cost_of_tiles = boxes_of_tiles * price_per_box
        labor_charges = hours_of_labor * labor_rate
        total_cost = cost_of_tiles + labor_charges

        print(f"The number of boxes of tiles required is: {boxes_of_tiles}")
        print(f"The cost of tiles will be: ${cost_of_tiles:.2f}")
        print(f"Labor charges are: ${labor_charges:.2f}")
        print(f"Total cost will be: ${total_cost:.2f}\n")

flooring_estimator()
Object-Oriented Programming

Book Collection Manager

2025

Interactive book collection management system using OOP principles. Manage book inventory with checkout/return functionality and persistent collection tracking using custom Book class with encapsulation.

OOP Classes Encapsulation State Management
Architecture

Book.py — Book class with private attributes (title, author, year, status) and methods for checkout, return, and info retrieval.

bookCollection.py — Manager script using list of Book objects, interactive menu system, and collection tracking.

Book.py
class Book:

    def __init__(self, title, author, year):
        self.__title = title
        self.__author = author
        self.__year = year
        self.__status = "available"

    def check_out(self):
        if self.__status == "available":
           self.__status = "checked out"
           return "The book has been checked out" 
        else:
            return "The book is not available"

    def return_book(self):
        if self.__status == "checked out":
           self.__status = "available"
           return "The book is returned and available for anyone to borrow"
        else:
            return "The book has not been checked out" 

    def get_info(self):
        return f"Title: {self.__title}\n Author: {self.__author}\n Year: {self.__year}\n Status: {self.__status}"
bookCollection.py (excerpt)
from Book import Book

def main():
    book_list = []

    print("Welcome to the book collection manager!")
    while True:
        book_title = input("Enter the title of the book: ")
        book_author = input("Enter the author of the book: ")
        book_year = input("Enter the year of publication: ")

        add_another_book = Book(book_title, book_author, book_year)
        book_list.append(add_another_book)

        while True:
            print("What would you like to do with this book?")
            print("1. Check out the book")
            print("2. Return the book")
            print("3. View the book information")
            print("4. Add another book")
            choice = input("Select a choice: ")

            if choice == "1":
                print(add_another_book.check_out())
            elif choice == "2":
                print(add_another_book.return_book())
            elif choice == "3":
                print("Book Information:")
                print(add_another_book.get_info())
            elif choice == "4":
                break

        repeat = input("Would you like to add another book? (y/n): ")
        if repeat.lower() != "y":
            break

    print("Total book collection:")
    for book in book_list:
        print(book.get_info())