Basic Counting in Python

Posted 2021-05-14 • Last updated 2021-10-15

I love fancy machine learning algorithms as much as anyone. But sometimes, you just need to count things. And Python’s built-in data structures make this really easy. Let’s say we have a list of strings: With a list like this, you might care about a few different counts. What’s the … Read more

Installing Packages in a Jupyter Notebook

Posted 2021-01-22 • Last updated 2021-10-15

This post describes a trick for installing/upgrading Python packages in a Jupyter notebook. It’s useful for scratch code, but don’t do this when you need reproducible code.

Combinations in Python

Posted 2020-12-28 • Last updated 2021-10-15

There are lots of ways to generate combinations in Python. This post will show you all of them.

Upgrading pip on macOS

Posted 2020-12-27 • Last updated 2021-10-15

A few ideas if you’re having trouble upgrading pip on macOS

How to Force pip to Reinstall a Package

Posted 2020-12-26 • Last updated 2021-10-15

Once in a while, a Python package gets corrupted on your machine and you need to force pip to reinstall it. As of pip 10.0, you can run the following…

Object Spread Operator for Python

Posted 2019-03-17 • Last updated 2021-10-15

The object spread operator is a useful pattern in JavaScript. You can do something similar in Python.