Geek Logbook

Tech sea log book

Parsing Complex Data from HTML Tables with Python

When working with web scraping, you often encounter scenarios where HTML content is nested or contains encoded data within JavaScript attributes. This post walks through parsing player statistics from a complex HTML table, utilizing Python and the BeautifulSoup library to streamline the extraction of JSON data hidden in JavaScript functions. Project Overview We have an

Comparative Investment Analysis of Invesco and Blackstone Using Python

Introduction In this post, we’ll explore how to use Python programming to compare the performance of two investment firms, Invesco and Blackstone. Invesco is known for its focus on public asset management, while Blackstone specializes in private equity, actively acquiring and managing companies. We’ll examine some key performance and risk metrics to understand how these

Built-in Functions vs. Object-Oriented Methods

Python strives to be simple and clear, so some operations are implemented as built-in functions, while others are object-specific methods. This distinction arises from the way Python handles different types of objects. Built-in Functions len() is a built-in function that works with many different types, including strings, lists, tuples, dictionaries, and more. This allows for

Downloading Data from the SEC Website using Python

In this blog post, I’ll show you how to download a JSON file from the U.S. Securities and Exchange Commission (SEC) website using Python. The file contains company tickers, which can be useful for various financial analyses and applications. Steps to Download the File Here’s a complete Python script that handles the download: Run the

Understanding Idempotency in Python with Simple Examples

Idempotency is a fundamental concept in computing that describes operations which produce the same result no matter how many times they are performed. In this blog post, we’ll explore idempotency through the lens of Python, diving into its significance and providing examples that highlight the difference between idempotent and non-idempotent operations. What is Idempotency? In

Renaming Modules in Python for Clarity and Accuracy

Renaming modules in Python is an essential practice to improve code clarity and maintainability, especially as projects grow in complexity. Using intuitive and descriptive names helps in quickly understanding the purpose of each module, reducing confusion and potential errors during development. In this post, we’ll explore the process of renaming a module in Python and

Counting Covered Points on a Number Line

Introduction Algorithmic challenges often involve intervals and can initially seem complex. One such problem is determining how many unique points are covered by a set of intervals on a number line. In this post, we’ll examine a solution to this problem and explore potential improvements. Problem Statement Given a number line with several intervals representing

Implementing Retries in Python

In many real-world applications, simply handling an error isn’t always enough. Sometimes, the failure is temporary, and retrying the operation can help resolve the issue. In this post, we’ll explore how to implement retries in Python, improving the robustness of our programs. Why Implement Retries? Let’s imagine you’re making a request to an external API