Plotting a time series heat map with Pandas

Heat maps communicate succinctly how the distribution of a value evolves over time. Performance metrics like latency or API response time often have a complicated multimodal distributions, and summarizing them in single values like mean or 90th percentile for a visualization makes many interesting events invisible. You need to look at histograms to see the full distribution, and that’s exactly what heat maps are: histograms, plotted over time, with color intensity signalling frequency.

Let’s see how we can use Pandas and Seaborn Python libraries to plot a heat map from a time series.

Continue reading “Plotting a time series heat map with Pandas”

Efficient and accurate rolling standard deviation

The usual algorithms for computing variance and standard deviation work on the full data set. What if you have a time series and want the standard deviation for a moving window? You could do the computation from fresh every time the window is advanced, but surely there’s a better way.

Continue reading “Efficient and accurate rolling standard deviation”

The Number With Negative Absolute Value

As you know, computers internally work only with ones and zeros, and everything is represented in some way using these “bits.” Using M bits you can encode 2M different values. Let’s say you’re interested in encoding the signed integers …, -1, 0, 1, 2, …. To make things simple, let’s use a fixed number of bits: for example with 8 bits you can encode 28 = 256 different numbers. One of the numbers is zero, so you are left with 255 bit patterns to be divided between positive and negative numbers. Can you see any problems with this?

Continue reading “The Number With Negative Absolute Value”

Verify and generate IBAN in PHP and MySQL

With the introduction of SEPA, the use of IBAN is now mandatory for all bank transactions in the Euro zone. This forces almost everyone to migrate their data, replacing national bank account numbers with IBANs. Fortunately this is a fairly simple task: to get the IBAN for an existing account, take the two-character country code, add two check digits, and then the national bank account number you already have. But how do you compute the check digits?

Continue reading “Verify and generate IBAN in PHP and MySQL”