1. Learn
  2. /
  3. Courses
  4. /
  5. Analyzing Police Activity with pandas

Exercise

Comparing violations by gender

The question we're trying to answer is whether male and female drivers tend to commit different types of traffic violations.

In this exercise, you'll first create a DataFrame for each gender, and then analyze the violations in each DataFrame separately.

Instructions

100 XP
  • Create a DataFrame, female, that only contains rows in which driver_gender is 'F'.
  • Create a DataFrame, male, that only contains rows in which driver_gender is 'M'.
  • Count the violations committed by female drivers and express them as proportions.
  • Count the violations committed by male drivers and express them as proportions.