Session Ready
Exercise

Plotting drug-related stops

In a small portion of traffic stops, drugs are found in the vehicle during a search. In this exercise, you'll assess whether these drug-related stops are becoming more common over time.

The Boolean column drugs_related_stop indicates whether drugs were found during a given stop. You'll calculate the annual drug rate by resampling this column, and then you'll use a line plot to visualize how the rate has changed over time.

Instructions
100 XP
  • Calculate the annual rate of drug-related stops by resampling the drugs_related_stop column (on the 'A' frequency) and taking the mean.
  • Save the annual drug rate Series as a new object, annual_drug_rate.
  • Create a line plot of annual_drug_rate using the .plot() method.
  • Display the plot using the .show() function.