Technology Tales

Notes drawn from experiences in consumer and enterprise technology

14:29, 21st August 2026

For efficient processing of large datasets, row-by-row loops in pandas should generally be replaced with column-based methods that use compiled operations. Vectorised arithmetic handles calculations, apply() supports custom conditional logic, np.where() manages binary conditions and np.select() handles multiple outcomes, while map() performs dictionary lookups, the .str accessor processes string columns and groupby() with agg() produces grouped summaries. Choosing the method that matches the transformation makes code faster, clearer and easier to maintain.

14:25, 21st August 2026

Efficient data preparation in Python can be improved through three idiomatic Pandas patterns: method chaining with .assign(), .query() and .pipe() for clearer, safer workflows; converting repetitive string columns to categorical data and using vectorised string operations to reduce memory use and processing time; and applying groupby().transform() to fill missing values with group-specific statistics while preserving row alignment. Together, these approaches reduce unnecessary copying, avoid SettingWithCopyWarning and replace slow row-by-row or custom grouping operations with scalable vectorised processing.

14:19, 21st August 2026

Data cleaning, a time-consuming yet essential part of data work, can be streamlined with five Python libraries that address common challenges such as structural inconsistencies, text encoding errors and data validation. Pyjanitor offers a fluent, chainable API for cleaning and transforming DataFrames, while Great Expectations enforces data quality through defined expectations and generates validation reports. Ftfy repairs Unicode and encoding issues in text, ydata-profiling automates exploratory data analysis with interactive reports and Cerberus validates arbitrary data structures with schema rules. Together, these tools enhance efficiency by reducing boilerplate code, improving data integrity and providing insights into dataset quality, allowing professionals to focus on analysis rather than manual corrections.

11:15, 21st August 2026

NumPy performance can be improved by replacing explicit Python loops and np.vectorize with native universal functions and broadcasting, which perform calculations in compiled code without unnecessary data duplication. In-place operators and the out parameter reduce temporary array creation, lowering memory use and improving speed. Basic slicing creates efficient, zero-copy views, whereas advanced indexing creates full copies; views are faster but share memory with the original array, so changes to them may affect the underlying data.

15:32, 6th June 2026

FastAPI is a popular Python framework for building modern APIs, valued for its speed, clean syntax and developer-friendly design. It scales from simple back-ends to machine learning applications, making it a practical choice across a wide range of projects.

A range of GitHub repositories can help developers learn the framework in different ways. These cover curated ecosystem resources, full-stack project templates combining FastAPI with React, PostgreSQL and Docker, practical coding tips for writing cleaner applications, and small stand-alone examples suited to beginners. Further repositories address user authentication and management, step-by-step project-based learning, reusable project templates for more scalable builds, microservices architecture using Docker Compose and Nginx and the use of FastAPI in AI image generation and machine learning model serving.

FastAPI Cloud offers a managed deployment platform that takes a locally built application live through a command-line interface with minimal configuration. Features include interactive API documentation, log monitoring and integrations comparable to other modern managed hosting platforms.

15:26, 6th June 2026

As Python datasets grow beyond what standard tools like pandas can handle, seven libraries have emerged as practical solutions for large-scale data processing. Each addresses a different constraint, whether that is memory, speed, distribution or latency.

PySpark brings distributed computing across clusters and supports both batch and streaming workloads alongside built-in machine learning capabilities. Dask closely mirrors the pandas and NumPy programming interfaces, scaling existing workflows to larger-than-memory datasets through lazy evaluation and parallel execution. Polars, written in Rust and built on the Apache Arrow columnar format, consistently outperforms pandas through parallelised operations and query optimisation before execution.

Ray, originally developed at UC Berkeley, enables distributed machine learning training and straightforward parallelisation of Python functions across clusters. Vaex takes a different approach, handling billions of rows on a single machine by memory-mapping data from disk rather than loading it fully into memory. Together, the two cover the spectrum from multi-node distributed training to single-machine scale without the overhead of a full cluster.

For real-time event streaming, Apache Kafka along with its Python clients manages millions of events per second with low latency and durable distributed storage. DuckDB operates as an in-process analytical database requiring no server setup, running fast SQL queries directly against local files in formats such as Parquet and CSV, with zero-copy integration with pandas and Arrow.

15:21, 6th June 2026

Python rewards developers who move beyond the basics, and five areas in particular repay the investment.Python rewards developers who move beyond the basics, and five areas in particular repay the investment. Each builds on core language features to unlock cleaner, faster and more maintainable code.

Type hinting pairs Python's typing module with the MyPy static analysis tool to annotate code with explicit data types. This catches mismatches before execution and makes codebases far easier to maintain at scale.

Functional programming tools such as map(), filter(), groupby() and itertools.chain() enable elegant, memory-efficient data manipulation by pushing iteration to optimised low-level internals. The result is cleaner code that avoids the overhead of manual Python loops.

Python's approach to multiple inheritance relies on C3 linearisation to determine method resolution order. Using super() correctly ensures that each constructor in an inheritance chain is called exactly once, avoiding the pitfalls of the diamond problem.

Introduced in Python 3.10, structural pattern matching via match and case goes well beyond a simple switch statement, allowing developers to match both the shape and values of complex data structures in a single declarative step. This proves especially valuable when processing API payloads or building state machines.

Finally, moving beyond basic pip installations and requirements files to modern dependency management tools such as Poetry or Conda provides deterministic, fully reproducible environments. Poetry offers strict lockfiles for application development, while Conda handles non-Python binary dependencies common in data science workloads.

15:16, 6th June 2026

Polars is a Rust-based DataFrame library that offers substantial performance advantages over Pandas when working with large datasets, owing to its parallel execution, lazy evaluation and single-pass algorithms. Three practical data problems illustrate where these gains are most pronounced.

The first involves ranking users by email activity. Polars replaces an expensive rank function with a simple row count after sorting, while its parallel group-by aggregation runs significantly faster than the sequential Pandas equivalent.

The second identifies returning customers who made a follow-up purchase within seven days of their first. The Pandas approach creates five separate in-memory copies of the data through deduplication, sorting, pivoting and filtering, whereas the Polars lazy chain allocates no memory until the final collection step, computing the earliest purchase date per user in a single pass.

The third calculates a cumulative monthly sales average. Polars pushes filter conditions before the join executes, reducing the volume of data processed from the outset, and its cumulative mean runs entirely in Rust without the Python-level loop overhead that affects the Pandas expanding window method.

Across all three cases, the performance gap is negligible on small datasets but grows considerably as row counts reach into the millions. That makes Polars a compelling option for analysts who regularly encounter the memory and speed limitations of Pandas at scale.

15:12, 6th June 2026

Vector search improves on traditional keyword matching by converting documents and queries into numerical vectors called embeddings, where geometric proximity in high-dimensional space reflects semantic similarity. A tutorial published by KDnuggets walks through building a functional vector search engine using only NumPy in Python, covering the core mechanics step by step.

The process involves storing product descriptions as simulated eight-dimensional embeddings arranged in three semantic clusters representing electronics, clothing and furniture, then normalising those vectors so that cosine similarity can be computed efficiently as a dot product. A simple index class handles storage and retrieval, with the search method performing a matrix multiplication against all stored vectors to rank results by similarity score. Query vectors constructed near each cluster centre consistently return the most relevant results, with scores approaching 1.0 indicating near-identical directional alignment in embedding space.

Principal component analysis is then used to project the eight-dimensional data down to two dimensions, revealing how cleanly the clusters separate and where query vectors land relative to their target groups. A bar chart visualising similarity scores across the full catalogue further illustrates the gap between relevant and irrelevant results, which in a real system could inform a threshold below which results would be suppressed. The tutorial concludes by noting that the index logic requires no modification to work with real embeddings generated by a model such as sentence-transformers.

15:08, 6th June 2026

Five Python decorators have proven particularly effective at keeping AI and machine learning code clean and well-structured. A concurrency limiter uses semaphores to throttle asynchronous requests to third-party large language models, preventing errors caused by free-tier rate limits. A structured logging decorator formats function executions and errors into searchable JSON logs, making debugging in production environments far more manageable than relying on standard print statements. A feature injector decorator ensures that raw input data undergoes consistent transformations before reaching a deployed model, removing the manual effort of replicating preprocessing steps from development into production. A deterministic seed setter locks random seeds during experimentation and hyperparameter tuning, isolating variables so that performance changes can be attributed to deliberate adjustments rather than random weight initialisation. Finally, a development-mode fallback decorator intercepts failures caused by external factors such as connection timeouts or API limits and returns predefined mock data instead, preventing an entire application from halting when a dependent service temporarily becomes unavailable.

  • The content, images, and materials on this website are protected by copyright law and may not be reproduced, distributed, transmitted, displayed, or published in any form without the prior written permission of the copyright holder. All trademarks, logos, and brand names mentioned on this website are the property of their respective owners. Unauthorised use or duplication of these materials may violate copyright, trademark and other applicable laws, and could result in criminal or civil penalties.

  • All comments on this website are moderated and should contribute meaningfully to the discussion. We welcome diverse viewpoints expressed respectfully, but reserve the right to remove any comments containing hate speech, profanity, personal attacks, spam, promotional content or other inappropriate material without notice. Please note that comment moderation may take up to 24 hours, and that repeatedly violating these guidelines may result in being banned from future participation.

  • By submitting a comment, you grant us the right to publish and edit it as needed, whilst retaining your ownership of the content. Your email address will never be published or shared, though it is required for moderation purposes.