There are frequently times where we would like to know when the last time something happened. For example, we might be interested in the last time unemployment was below 5% or the last time the stock market went up five days in a row or the last time you had eight hours of sleep. The merge_asof function provides answers to these types of questions.
Finding the last time crime was 20% lower with merge_asof
Getting ready
In this recipe, we will find the current month's total number of crimes for each offense category and then find the last time there were 20% fewer incidences.