Posts tagged "python"
8 posts
Demonstrating handling Python errors with reproducible scripts
Better Python error handling with the traceback module, using uv's PEP 723 support for reproducible scripts, so production errors carry useful stack traces.
Quickly checking Python dependencies
A short snippet for using `uv` to iterate on changing Python project dependencies.
LLMs on the command line
How I use large language models from the command line to automate developer tasks: code review, summarising files, extracting web pages, inspecting processes.
How to Safely Upsert DataFrames into Postgres
A Python script that upserts Pandas DataFrames into Postgres with psycopg2, building the SQL safely against injection and batching writes with execute_batch.
Classifying data with Python
Using scikit-learn to build a machine-learning pipeline that compares how well different classifiers predict the movement of a stock price.
Calculating covariance matrices with Python
I wanted to use lower level linear algebra constructs in Python to calculate a covariance matrix.
How to reduce the memory used by Pandas DataFrames
A script illustrating how the memory usage of a pandas DataFrame can be reduced through altering data types.
Reconstructing a point set from a Euclidean Distance Matrix
Recovering point locations from vectors.