1. 学习
  2. /
  3. 课程
  4. /
  5. Analyzing Police Activity with pandas

Connected

练习

Comparing search rates by gender

In this exercise, you'll compare the rates at which female and male drivers are searched during a traffic stop. Remember that the vehicle search rate across all stops is about 3.8%.

First, you'll filter the DataFrame by gender and calculate the search rate for each group separately. Then, you'll perform the same calculation for both genders at once using a .groupby().

说明 1 / 共 3 个

undefined XP
    1
    2
    3
  • Filter the DataFrame to only include female drivers, and then calculate the search rate by taking the mean of search_conducted.