Installing packages in a Jupyter notebook
2021-01-22
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.
The quick start guide to plotting histograms in Seaborn
2021-01-21
The histplot() function in Seaborn is a great API for plotting histograms to visualize the distribution of your Pandas columns.
Normalizing Images in PyTorch
2021-01-15
You can use the torchvision Normalize() transform to subtract the mean and divide by the standard deviation for image tensors in PyTorch. But it's important to understand how the transform works and how to reverse it.
Dropping columns and rows in Pandas
2021-01-14
There are a few ways to drop columns and rows in Pandas. This post describes the easiest way to do it and provides a few alternatives that can sometimes be useful.
The easiest way to rename a column in Pandas
2021-01-12
Two easy recipes for renaming column(s) in a Pandas DataFrame.
Reshaping arrays: How the NumPy reshape operation works
2021-01-11
This post explains how the NumPy reshape operation works, how to use it and gotchas to watch out for.
Calculating the norm of an array in NumPy: all about np.linalg.norm()
2021-01-08
You can calculate the L1 and L2 norms of a vector or the Frobenius norm of a matrix in NumPy with np.linalg.norm(). This post explains the API and gives a few concrete usage examples.