Making a dumb smart light switch with a Raspberry Pi Pico

How I made a dumb smart switch with a Raspberry Pi Pico to control a Philips Hue smart light.


Flickering-flame LED effect using MicroPython on a Raspberry Pi Pico

This post describes how to wire up an electrical circuit and write a simple MicroPython script to deploy onto a Raspberry Pi Pico to create a flickering-flame LED effect.


How to develop and test a minimal API in Python with Flask

This post describes how to develop and test an API in Python with Flask. The API is minimal and self-contained, with very few dependencies beyond the Python standard library.


Using the GitHub API to find open-source projects looking for contributions

19 March, 2022
Python git

I often read that a great way to get better at programming is to contribute to open-source projects. The problem is, open-source projects that are looking for help aren't all that easy to find. To find some leads on such projects, we can use the GitHub API.


Simple logistic regression with Python

Logistic regression is used to predict a binary response. Let's see how to use Python to construct a logistic regression model that'll tell us which factors affected the passengers' chance of survival.


Regression case study part two: New Zealand's greenhouse gas emissions

In part two, we dive deeper into some aspects of regression modelling, including multiple regression and evaluating model fit.


Regression case study part one: New Zealand's greenhouse gas emissions

This is the first of two posts describing the development and evaluation of a regression model of NZ's greenhouse gas emissions.


Statistical interactions between variables with Python

A statistical interaction occurs when the effect of one variable is moderated by another variable. Here, we'll show how the relationship between a car's fuel efficiency and engine displacement changes with the number of cylinders.


Simple Pearson correlation with Python

The Pearson correlation coefficient measures the relationship between two continuous variables. We'll show how to obtain a Pearson correlation coefficient in Python.


Simple chi-squared test with Python

The chi-squared test is used to determine the statistical significance of a categorical explanatory variable's effect on a categorical response variable. We'll show to how to conduct a simple chi-squared test in Python.


Simple ANOVA with Python

In this quick tutorial, we describe how to conduct a simple ANOVA statistical test on the iris dataset with Python.


Leaflet maps in Django with model-backed geoJSON data

2 December, 2020 (updated 9 April, 2021)
Python Django GIS Leaflet geojson

We can create Leaflet maps with simple location data, using only the default Django models and a home-made geoJSON serialiser. Let's avoid bloated geographical libraries and see how lightweight we can get our maps to be.


Setting environment variables for Django in Linux

22 September, 2020
Python Django Linux

Setting environment variables for your Django web-application is pretty simple: here's how you do it.


Behavioural psychology and Python: Part 1

In The Undoing Project, Michael Lewis's excellent book about two groundbreaking behavioural psychologists, we get a glimpse at some of the mechanisms that drive our judgements and decisions. By coming up with interesting questions to pose to ...